Bug 1499096 - Update wrong usage of ok() with todo_is();r=Standard8

Depends on D8739.
This changeset updates calls to ok() that were most likely intended
for is(), but are not working as is.

Differential Revision: https://phabricator.services.mozilla.com/D8740

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2018-10-23 07:13:02 +00:00
parent 2fcd6cb020
commit 52b85a20e2
9 changed files with 49 additions and 13 deletions

View File

@ -16,7 +16,10 @@ add_task(async function test() {
gBrowser.showOnlyTheseTabs([origTab]);
pressCtrlTab();
ok(ctrlTab.tabList.length, 1, "Show 1 tab in tab preview");
// XXX: Switched to from ok() to todo_is() in Bug 1467712. Follow up in 1500959
// `ctrlTab.tabList.length` is still equal to 3 at this step.
todo_is(ctrlTab.tabList.length, 1, "Show 1 tab in tab preview");
ok(!ctrlTab.isOpen, "With 1 tab open, Ctrl+Tab doesn't open the preview panel");
gBrowser.showOnlyTheseTabs([origTab, tabOne, tabTwo]);

View File

@ -33,7 +33,11 @@ add_task(async function() {
enabled = true;
PerformanceController._setMultiprocessAttributes();
ok($("#performance-view").getAttribute("e10s"), "",
// XXX: Switched to from ok() to todo_is() in Bug 1467712. Follow up in 1500913
// This cannot work with the current implementation, _setMultiprocessAttributes is not
// removing existing attributes.
todo_is($("#performance-view").getAttribute("e10s"), "",
"When e10s is enabled, there should be no e10s attribute.");
await teardownToolboxAndRemoveTab(panel);

View File

@ -129,8 +129,7 @@ addTest(function testLoseRace() {
let front = null;
promiseDone(gWalker.querySelector(gWalker.rootNode, "#z").then(node => {
front = node;
gInspectee.querySelector("#z").parentNode = null;
const contentNode = gInspectee.querySelector("#a");
const contentNode = gInspectee.querySelector("#z");
contentNode.remove();
return promiseOnce(gWalker, "new-mutations");
}).then(() => {
@ -140,7 +139,15 @@ addTest(function testLoseRace() {
return gWalker.retainNode(front);
}).then(() => ok(false, "Request should not have succeeded!"),
(err) => {
ok(err, "noSuchActor", "Should have lost the race.");
// XXX: Switched to from ok() to todo_is() in Bug 1467712. Follow up in
// 1500960
// This is throwing because of
// `gInspectee.querySelector("#z").parentNode = null;` two blocks above...
// Even if you fix that, the test is still failing because "#a" was removed
// by the previous test. I am switching this to "#z" because I think that
// was the original intent. Still not failing with the expected error message
// Needs more work.
// ok(err, "noSuchActor", "Should have lost the race.");
is(gWalker._retainedOrphans.size, 0, "Should have no more retained orphans.");
// Don't re-throw the error.
}).then(runNextTest));

View File

@ -137,9 +137,15 @@ function runTests()
is(textRect.left, left.value,
"sendQueryContentEvent(QUERY_TEXT_RECT_ARRAY) should return same left that returns QUERY_TEXT_RECT");
textRectArray.getCharacterRect(1, left2, top2, width2, height2);
ok(textRect.width, width.value + width2.value,
"sendQueryContentEvent(QUERY_TEXT_RECT_ARRAY) should return same width that QUERY_TEXT_RECT is returned for offset 1 and 2");
ok(textRect.height, height.value,
// XXX: Switched to from ok() to todo_is() in Bug 1467712. Follow up in 1500961
// jdescottes: Bug 1467712 - wrong usage of ok(). This does not pass when switching to is():
// "got 16, expected 17". However on some other platforms it works as expected so we cannot
// use todo_is().
// is(textRect.width, width.value + width2.value,
// "sendQueryContentEvent(QUERY_TEXT_RECT_ARRAY) should return same width that QUERY_TEXT_RECT is returned for offset 1 and 2");
is(textRect.height, height.value,
"sendQueryContentEvent(QUERY_TEXT_RECT_ARRAY) should return same height that returns QUERY_TEXT_RECT");
// QueryCharacterAtOffset

View File

@ -484,7 +484,9 @@
<script>
var u = new URL('http://www.example.org');
ok(u.toJSON(), 'http://www.example.org', "URL.toJSON()");
// XXX: Switched to from ok() to todo_is() in Bug 1467712. Follow up in 1500962
// This would work with `http://www.example.org/` (trailing "/")
todo_is(u.toJSON(), 'http://www.example.org', "URL.toJSON()");
is(JSON.stringify(u), "\"http://www.example.org/\"", "JSON.stringify(u) works");
</script>
</body>

View File

@ -28,7 +28,12 @@ SimpleTest.waitForFocus(function() {
element.selectionEnd = 4;
synthesizeKey("KEY_Backspace", {repeat: 4});
ok(element.value, "", "4 backspaces should delete all of the characters in the " + element.localName);
// XXX: Switched to from ok() to todo_is() in Bug 1467712. Follow up in 1500964
// This test is not working for several reasons:
// - race conditions between each event, we should wait before sending the next backspace
// - race conditions between the two tests
// - the value has an initial length of 8, not 4
todo_is(element.value, "", "4 backspaces should delete all of the characters in the " + element.localName);
}
doTest(document.querySelector("input"));

View File

@ -967,7 +967,9 @@ decorate_task(
"experiment value",
"The startup value for fake.default was set",
);
ok(
// XXX: Switched to from ok() to todo_is() in Bug 1467712. Follow up in 1500965
// This expects 0, but the test value is 32
todo_is(
Services.prefs.getPrefType(`${startupPrefs}.fake.user`),
Services.prefs.PREF_INVALID,
"The startup value for fake.user was not set",

View File

@ -104,7 +104,10 @@
// Try various ways to get the custom interface.
let asControl = twoElement.getCustomInterfaceCallback(Ci.nsIDOMXULControlElement);
ok(asControl, twoElement, "getCustomInterface returns interface implementation ");
// XXX: Switched to from ok() to todo_is() in Bug 1467712. Follow up in 1500967
// Not sure if this was suppose to simply check for existence or equality?
todo_is(asControl, twoElement, "getCustomInterface returns interface implementation ");
asControl = twoElement.QueryInterface(Ci.nsIDOMXULControlElement);
ok(asControl, "QueryInterface to nsIDOMXULControlElement");

View File

@ -195,7 +195,11 @@ function test_tabbox_focus()
var textboxExtra = $("textbox-extra");
textboxExtra.addEventListener("focus", function () {
textboxExtra.removeEventListener("focus", arguments.callee, true);
ok(document.activeElement, textboxExtra, "focus in tab with focus currently in textbox that is sibling of tabs");
// XXX: Switched to from ok() to todo_is() in Bug 1467712. Follow up in 1500971
// Here the active element is not the XUL textbox but an HTML input inside it.
// textboxExtra is document.activeElement.parentNode.parentNode.
todo_is(document.activeElement, textboxExtra, "focus in tab with focus currently in textbox that is sibling of tabs");
SimpleTest.finish();
}, true);