summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser_console_server_logging.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/webconsole/test/browser_console_server_logging.js')
-rw-r--r--devtools/client/webconsole/test/browser_console_server_logging.js74
1 files changed, 74 insertions, 0 deletions
diff --git a/devtools/client/webconsole/test/browser_console_server_logging.js b/devtools/client/webconsole/test/browser_console_server_logging.js
new file mode 100644
index 000000000..eaef12330
--- /dev/null
+++ b/devtools/client/webconsole/test/browser_console_server_logging.js
@@ -0,0 +1,74 @@
+/* -*- 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/ */
+
+"use strict";
+
+// Check that server log appears in the console panel - bug 1168872
+add_task(function* () {
+ const TEST_URI = "http://example.com/browser/devtools/client/webconsole/test/test-console-server-logging.sjs";
+
+ yield loadTab(TEST_URI);
+
+ let hud = yield openConsole();
+
+ // Set logging filter and wait till it's set on the backend
+ hud.setFilterState("serverlog", true);
+ yield updateServerLoggingListener(hud);
+
+ BrowserReloadSkipCache();
+
+ // Note that the test is also checking out the (printf like)
+ // formatters and encoding of UTF8 characters (see the one at the end).
+ let text = "values: string Object { a: 10 } 123 1.12 \u2713";
+
+ yield waitForMessages({
+ webconsole: hud,
+ messages: [{
+ text: text,
+ category: CATEGORY_SERVER,
+ severity: SEVERITY_LOG,
+ }],
+ });
+ // Clean up filter
+ hud.setFilterState("serverlog", false);
+ yield updateServerLoggingListener(hud);
+});
+
+add_task(function* () {
+ const TEST_URI = "http://example.com/browser/devtools/client/webconsole/test/test-console-server-logging-array.sjs";
+
+ yield loadTab(TEST_URI);
+
+ let hud = yield openConsole();
+
+ // Set logging filter and wait till it's set on the backend
+ hud.setFilterState("serverlog", true);
+ yield updateServerLoggingListener(hud);
+
+ BrowserReloadSkipCache();
+ // Note that the test is also checking out the (printf like)
+ // formatters and encoding of UTF8 characters (see the one at the end).
+ let text = "Object { best: \"Firefox\", reckless: \"Chrome\", " +
+ "new_ie: \"Safari\", new_new_ie: \"Edge\" }";
+ yield waitForMessages({
+ webconsole: hud,
+ messages: [{
+ text: text,
+ category: CATEGORY_SERVER,
+ severity: SEVERITY_LOG,
+ }],
+ });
+ // Clean up filter
+ hud.setFilterState("serverlog", false);
+ yield updateServerLoggingListener(hud);
+});
+
+function updateServerLoggingListener(hud) {
+ let deferred = promise.defer();
+ hud.ui._updateServerLoggingListener(response => {
+ deferred.resolve(response);
+ });
+ return deferred.promise;
+}