From fecf79feba649b18f9d061283f60411019973e98 Mon Sep 17 00:00:00 2001 From: Mihai Sucan Date: Tue, 11 Mar 2014 13:32:33 +0200 Subject: [PATCH] Bug 979628 - Fix for intermittent browser_webconsole_output_01.js | This test exceeded the timeout threshold; r=me --- browser/devtools/webconsole/test/browser.ini | 1 + .../test/browser_webconsole_output_01.js | 77 ++--------------- .../test/browser_webconsole_output_05.js | 84 +++++++++++++++++++ 3 files changed, 90 insertions(+), 72 deletions(-) create mode 100644 browser/devtools/webconsole/test/browser_webconsole_output_05.js diff --git a/browser/devtools/webconsole/test/browser.ini b/browser/devtools/webconsole/test/browser.ini index 9de382ece30f..ec54b6c6ced1 100644 --- a/browser/devtools/webconsole/test/browser.ini +++ b/browser/devtools/webconsole/test/browser.ini @@ -267,6 +267,7 @@ run-if = os == "mac" [browser_webconsole_output_02.js] [browser_webconsole_output_03.js] [browser_webconsole_output_04.js] +[browser_webconsole_output_05.js] [browser_webconsole_output_dom_elements_01.js] [browser_webconsole_output_dom_elements_02.js] [browser_webconsole_output_dom_elements_03.js] diff --git a/browser/devtools/webconsole/test/browser_webconsole_output_01.js b/browser/devtools/webconsole/test/browser_webconsole_output_01.js index b1c763369069..a7531a4b02ea 100644 --- a/browser/devtools/webconsole/test/browser_webconsole_output_01.js +++ b/browser/devtools/webconsole/test/browser_webconsole_output_01.js @@ -7,7 +7,6 @@ const TEST_URI = "data:text/html;charset=utf8,test for console output - 01"; -let dateNow = Date.now(); let {DebuggerServer} = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {}); let LONG_STRING_LENGTH = DebuggerServer.LONG_STRING_LENGTH; @@ -76,70 +75,6 @@ let inputTests = [ output: "/foobar/", inspectable: true, }, - - // 9 - { - input: "/foo?b*\\s\"ar/igym", - output: "/foo?b*\\s\"ar/gimy", - printOutput: "/foo?b*\\s\"ar/gimy", - inspectable: true, - }, - - // 10 - { - input: "null", - output: "null", - }, - - // 11 - { - input: "undefined", - output: "undefined", - }, - - // 12 - { - input: "true", - output: "true", - }, - - // 13 - { - input: "new Boolean(false)", - output: "false", - inspectable: true, - }, - - // 14 - { - input: "new Date(" + dateNow + ")", - output: "Date " + (new Date(dateNow)).toISOString(), - printOutput: (new Date(dateNow)).toString(), - inspectable: true, - }, - - // 15 - { - input: "new Date('test')", - output: "Invalid Date", - printOutput: "Invalid Date", - inspectable: true, - variablesViewLabel: "Invalid Date", - }, - - // 16 - { - input: "new Number(43)", - output: "43", - inspectable: true, - }, - - // 17 - { - input: "new String('hello world')", - output: '"hello world"', - inspectable: true, - }, ]; longString = initialString = null; @@ -150,11 +85,9 @@ function test() { DebuggerServer.LONG_STRING_INITIAL_LENGTH = LONG_STRING_INITIAL_LENGTH; }); - addTab(TEST_URI); - browser.addEventListener("load", function onLoad() { - browser.removeEventListener("load", onLoad, true); - openConsole().then((hud) => { - return checkOutputForInputs(hud, inputTests); - }).then(finishTest); - }, true); + Task.spawn(function*() { + let {tab} = yield loadTab(TEST_URI); + let hud = yield openConsole(tab); + return checkOutputForInputs(hud, inputTests); + }).then(finishTest); } diff --git a/browser/devtools/webconsole/test/browser_webconsole_output_05.js b/browser/devtools/webconsole/test/browser_webconsole_output_05.js new file mode 100644 index 000000000000..5c168cec2575 --- /dev/null +++ b/browser/devtools/webconsole/test/browser_webconsole_output_05.js @@ -0,0 +1,84 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// Test the webconsole output for various types of objects. + +const TEST_URI = "data:text/html;charset=utf8,test for console output - 05"; + +let dateNow = Date.now(); + +let inputTests = [ + // 0 + { + input: "/foo?b*\\s\"ar/igym", + output: "/foo?b*\\s\"ar/gimy", + printOutput: "/foo?b*\\s\"ar/gimy", + inspectable: true, + }, + + // 1 + { + input: "null", + output: "null", + }, + + // 2 + { + input: "undefined", + output: "undefined", + }, + + // 3 + { + input: "true", + output: "true", + }, + + // 4 + { + input: "new Boolean(false)", + output: "false", + inspectable: true, + }, + + // 5 + { + input: "new Date(" + dateNow + ")", + output: "Date " + (new Date(dateNow)).toISOString(), + printOutput: (new Date(dateNow)).toString(), + inspectable: true, + }, + + // 6 + { + input: "new Date('test')", + output: "Invalid Date", + printOutput: "Invalid Date", + inspectable: true, + variablesViewLabel: "Invalid Date", + }, + + // 7 + { + input: "new Number(43)", + output: "43", + inspectable: true, + }, + + // 8 + { + input: "new String('hello world')", + output: '"hello world"', + inspectable: true, + }, +]; + +function test() { + Task.spawn(function*() { + let {tab} = yield loadTab(TEST_URI); + let hud = yield openConsole(tab); + return checkOutputForInputs(hud, inputTests); + }).then(finishTest); +}