Bug 1403902 - migrate browser_webconsole_bug_580454_timestamp_l10n to xpcshell test;r=nchevobbe
MozReview-Commit-ID: 6uMMrzMSJB6
--- a/devtools/client/webconsole/new-console-output/test/moz.build
+++ b/devtools/client/webconsole/new-console-output/test/moz.build
@@ -10,8 +10,12 @@ BROWSER_CHROME_MANIFESTS += [
DIRS += [
'fixtures'
]
MOCHITEST_CHROME_MANIFESTS += [
'chrome/chrome.ini',
]
+
+XPCSHELL_TESTS_MANIFESTS += [
+ 'unit/xpcshell.ini'
+]
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/unit/.eslintrc.js
@@ -0,0 +1,6 @@
+"use strict";
+
+module.exports = {
+ // Extend from the common devtools xpcshell eslintrc config.
+ "extends": "../../../../../.eslintrc.xpcshell.js"
+};
rename from devtools/client/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js
rename to devtools/client/webconsole/new-console-output/test/unit/test_webconsole_l10n.js
--- a/devtools/client/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js
+++ b/devtools/client/webconsole/new-console-output/test/unit/test_webconsole_l10n.js
@@ -1,26 +1,22 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that appropriately-localized timestamps are printed.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
-const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
- "test/test-console.html";
+const { utils: Cu } = Components;
+const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
-add_task(function* () {
- yield loadTab(TEST_URI);
+function run_test() {
const TEST_TIMESTAMP = 12345678;
+ const WCUL10n = require("devtools/client/webconsole/webconsole-l10n");
let date = new Date(TEST_TIMESTAMP);
let localizedString = WCUL10n.timestampString(TEST_TIMESTAMP);
- isnot(localizedString.indexOf(date.getHours()), -1, "the localized " +
- "timestamp contains the hours");
- isnot(localizedString.indexOf(date.getMinutes()), -1, "the localized " +
- "timestamp contains the minutes");
- isnot(localizedString.indexOf(date.getSeconds()), -1, "the localized " +
- "timestamp contains the seconds");
- isnot(localizedString.indexOf(date.getMilliseconds()), -1, "the localized " +
- "timestamp contains the milliseconds");
-});
+ ok(localizedString.includes(date.getHours()),
+ "the localized timestamp contains the hours");
+ ok(localizedString.includes(date.getMinutes()),
+ "the localized timestamp contains the minutes");
+ ok(localizedString.includes(date.getSeconds()),
+ "the localized timestamp contains the seconds");
+ ok(localizedString.includes(date.getMilliseconds()),
+ "the localized timestamp contains the milliseconds");
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/unit/xpcshell.ini
@@ -0,0 +1,6 @@
+[DEFAULT]
+tags = devtools
+firefox-appdir = browser
+skip-if = toolkit == 'android'
+
+[test_webconsole_l10n.js]
--- a/devtools/client/webconsole/test/browser.ini
+++ b/devtools/client/webconsole/test/browser.ini
@@ -212,17 +212,16 @@ skip-if = (os == 'win' && bits == 64) #
skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
[browser_webconsole_assert.js]
[browser_webconsole_block_mixedcontent_securityerrors.js]
tags = mcb
skip-if = (os == 'win' && bits == 64) # Bug 1390001
[browser_webconsole_bug_579412_input_focus.js]
[browser_webconsole_bug_580001_closing_after_completion.js]
[browser_webconsole_bug_580030_errors_after_page_reload.js]
-[browser_webconsole_bug_580454_timestamp_l10n.js]
[browser_webconsole_bug_582201_duplicate_errors.js]
[browser_webconsole_bug_583816_No_input_and_Tab_key_pressed.js]
[browser_webconsole_bug_585237_line_limit.js]
[browser_webconsole_bug_585956_console_trace.js]
[browser_webconsole_bug_585991_autocomplete_keys.js]
[browser_webconsole_bug_585991_autocomplete_popup.js]
[browser_webconsole_bug_586388_select_all.js]
[browser_webconsole_bug_587617_output_copy.js]