mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1155493 - Part 4: Add test for mozbrowsercaretstatechanged. r=kchen
This commit is contained in:
parent
cb0b085920
commit
bb669f48bb
@ -65,6 +65,10 @@ const browserElementTestHelpers = {
|
|||||||
this._setPref('selectioncaret.enabled', value);
|
this._setPref('selectioncaret.enabled', value);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setAccessibleCaretEnabledPref: function(value) {
|
||||||
|
this._setPref('layout.accessiblecaret.enabled', value);
|
||||||
|
},
|
||||||
|
|
||||||
getOOPByDefaultPref: function() {
|
getOOPByDefaultPref: function() {
|
||||||
return this._getBoolPref("dom.ipc.browser_frames.oop_by_default");
|
return this._getBoolPref("dom.ipc.browser_frames.oop_by_default");
|
||||||
},
|
},
|
||||||
|
@ -21,6 +21,7 @@ var defaultData;
|
|||||||
var pasteData;
|
var pasteData;
|
||||||
var focusScript;
|
var focusScript;
|
||||||
var createEmbededFrame = false;
|
var createEmbededFrame = false;
|
||||||
|
var testAccessibleCaret = false;
|
||||||
|
|
||||||
function copyToClipboard(str) {
|
function copyToClipboard(str) {
|
||||||
gTextarea.value = str;
|
gTextarea.value = str;
|
||||||
@ -160,16 +161,24 @@ function dispatchTest(e) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (createEmbededFrame || browserElementTestHelpers.getOOPByDefaultPref()) {
|
if (createEmbededFrame || browserElementTestHelpers.getOOPByDefaultPref()) {
|
||||||
SimpleTest.finish();
|
if (testAccessibleCaret) {
|
||||||
|
SimpleTest.finish();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
testAccessibleCaret = true;
|
||||||
|
createEmbededFrame = false;
|
||||||
|
browserElementTestHelpers.setSelectionChangeEnabledPref(false);
|
||||||
|
browserElementTestHelpers.setAccessibleCaretEnabledPref(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
createEmbededFrame = true;
|
createEmbededFrame = true;
|
||||||
|
|
||||||
// clean up and run test again.
|
|
||||||
document.body.removeChild(iframeOuter);
|
|
||||||
document.body.removeChild(gTextarea);
|
|
||||||
state = 0;
|
|
||||||
runTest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clean up and run test again.
|
||||||
|
document.body.removeChild(iframeOuter);
|
||||||
|
document.body.removeChild(gTextarea);
|
||||||
|
state = 0;
|
||||||
|
runTest();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,14 +192,17 @@ function isChildProcess() {
|
|||||||
function testSelectAll(e) {
|
function testSelectAll(e) {
|
||||||
// Skip mozbrowser test if we're at child process.
|
// Skip mozbrowser test if we're at child process.
|
||||||
if (!isChildProcess()) {
|
if (!isChildProcess()) {
|
||||||
iframeOuter.addEventListener("mozbrowserselectionstatechanged", function selectchangeforselectall(e) {
|
let eventName = testAccessibleCaret ? "mozbrowsercaretstatechanged" : "mozbrowserselectionstatechanged";
|
||||||
if (e.detail.states.indexOf('selectall') == 0) {
|
iframeOuter.addEventListener(eventName, function selectchangeforselectall(e) {
|
||||||
iframeOuter.removeEventListener("mozbrowserselectionstatechanged", selectchangeforselectall, true);
|
if (!e.detail.states || e.detail.states.indexOf('selectall') == 0) {
|
||||||
|
iframeOuter.removeEventListener(eventName, selectchangeforselectall, true);
|
||||||
ok(true, "got mozbrowserselectionstatechanged event." + stateMeaning);
|
ok(true, "got mozbrowserselectionstatechanged event." + stateMeaning);
|
||||||
ok(e.detail, "event.detail is not null." + stateMeaning);
|
ok(e.detail, "event.detail is not null." + stateMeaning);
|
||||||
ok(e.detail.width != 0, "event.detail.width is not zero" + stateMeaning);
|
ok(e.detail.width != 0, "event.detail.width is not zero" + stateMeaning);
|
||||||
ok(e.detail.height != 0, "event.detail.height is not zero" + stateMeaning);
|
ok(e.detail.height != 0, "event.detail.height is not zero" + stateMeaning);
|
||||||
ok(e.detail.states, "event.detail.state " + e.detail.states);
|
if (!testAccessibleCaret) {
|
||||||
|
ok(e.detail.states, "event.detail.state " + e.detail.states);
|
||||||
|
}
|
||||||
SimpleTest.executeSoon(function() { testCopy1(e); });
|
SimpleTest.executeSoon(function() { testCopy1(e); });
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user