Bug 881463 - Fix for intermittent browser_selection_textarea.js. r=rsilveira

This commit is contained in:
Jim Mathies 2013-07-17 13:43:26 -05:00
parent fbf39695fe
commit 34c2c0e703
2 changed files with 12 additions and 58 deletions

View File

@ -5,17 +5,8 @@
<body>
<form action="texarea.html">
<div style="margin-left: 250px;">
<textarea wrap="on" style="width:800px; height:100px; overflow:scroll;" id="inputtext">
Alice was beginning to get very tired of sitting by her sister on the bank, and of having
nothing to do: once or twice she had peeped into the book her sister was reading, but it
had no pictures or conversations in it, `and what is the use of a book,' thought Alice
`without pictures or conversation?'
Either the well was very deep, or she fell very slowly, for she had plenty of time as she
went down to look about her and to wonder what was going to happen next. First, she tried
to look down and make out what she was coming to, but it was too dark to see anything;
then she looked at the sides of the well, and noticed that they were filled with cupboards
and book-shelves;(end)</textarea>
<textarea wrap="on" style="width:400px; height:75px; overflow:scroll;" id="inputtext">
Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, `and what is the use of a book,' thought Alice `without pictures or conversation?'(end)</textarea>
</div>
</body>
</html>

View File

@ -48,41 +48,7 @@ gTests.push({
});
gTests.push({
desc: "textarea basic selection",
setUp: setUpAndTearDown,
tearDown: setUpAndTearDown,
run: function test() {
let textarea = gWindow.document.getElementById("inputtext");
textarea.focus();
let promise = waitForEvent(document, "popupshown");
sendContextMenuClick(355, 50);
yield promise;
checkContextUIMenuItemVisibility(["context-select",
"context-select-all"]);
let menuItem = document.getElementById("context-select");
ok(menuItem, "menu item exists");
ok(!menuItem.hidden, "menu item visible");
let popupPromise = waitForEvent(document, "popuphidden");
sendElementTap(gWindow, menuItem);
yield popupPromise;
ok(popupPromise && !(popupPromise instanceof Error), "promise error");
yield waitForCondition(function () {
return SelectionHelperUI.isSelectionUIVisible;
}, kCommonWaitMs, kCommonPollMs);
// check text selection
is(getTrimmedSelection(textarea).toString(), "pictures", "selection test");
clearSelection(textarea);
},
});
gTests.push({
desc: "textarea complex drag selection",
desc: "textarea selection and drag",
setUp: setUpAndTearDown,
tearDown: setUpAndTearDown,
run: function test() {
@ -90,9 +56,10 @@ gTests.push({
yield waitForMs(100);
let textarea = gWindow.document.getElementById("inputtext");
textarea.focus();
let promise = waitForEvent(document, "popupshown");
sendContextMenuClick(355, 50);
sendContextMenuClickToElement(gWindow, textarea, 20, 10);
yield promise;
checkContextUIMenuItemVisibility(["context-select",
@ -111,8 +78,8 @@ gTests.push({
}, kCommonWaitMs, kCommonPollMs);
is(SelectionHelperUI.isActive, true, "selection active");
is(getTrimmedSelection(textarea).toString(), "pictures", "selection test");
is(getTrimmedSelection(textarea).toString(), "Alice", "selection test");
let xpos = SelectionHelperUI.endMark.xPos;
let ypos = SelectionHelperUI.endMark.yPos + 10;
@ -120,15 +87,15 @@ gTests.push({
// end marker and off the text area to the right
yield touchdrag.start(gWindow, xpos, ypos, 1200, 400);
let textLength = getTrimmedSelection(textarea).toString().length;
let token = "(end)";
yield waitForCondition(function () {
let newTextLength = getTrimmedSelection(textarea).toString().length;
if (textLength != newTextLength) {
textLength = newTextLength;
let selection = getTrimmedSelection(textarea).toString();
if (selection.length < token.length ||
selection.substring(selection.length - token.length) != token) {
return false;
}
return true;
}, 45000, 1000);
}, 5000, 100);
touchdrag.end();
touchdrag = null;
@ -137,10 +104,6 @@ gTests.push({
return !SelectionHelperUI.hasActiveDrag;
}, kCommonWaitMs, kCommonPollMs);
yield SelectionHelperUI.pingSelectionHandler();
let text = getTrimmedSelection(textarea).toString();
let end = text.substring(text.length - "(end)".length);
is(end, "(end)", "selection test");
},
});