Bug 1291352 - Add basic mochitest-browser for new console frontend;r=linclark draft
authorBrian Grinstead <briangrinstead@gmail.com>
Mon, 01 Aug 2016 16:03:16 -0700
changeset 395715 52c5a28050378d1586332935cbfbff3d2bdd1b3f
parent 395624 6608e5864780589b25d5421c3d3673ab30c4c318
child 527040 0590e124c9bd481c4cce4d11761e82fc81279ac5
push id24822
push userbmo:lclark@mozilla.com
push dateTue, 02 Aug 2016 18:08:17 +0000
reviewerslinclark
bugs1291352
milestone51.0a1
Bug 1291352 - Add basic mochitest-browser for new console frontend;r=linclark MozReview-Commit-ID: AOWynjHPJaK
devtools/client/webconsole/new-console-output/components/console-output.js
devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_init.js
devtools/client/webconsole/new-console-output/test/mochitest/head.js
devtools/client/webconsole/new-console-output/test/mochitest/test-console.html
devtools/client/webconsole/new-console-output/test/moz.build
--- a/devtools/client/webconsole/new-console-output/components/console-output.js
+++ b/devtools/client/webconsole/new-console-output/components/console-output.js
@@ -14,19 +14,17 @@ const { connect } = require("devtools/cl
 
 const { getAllMessages } = require("devtools/client/webconsole/new-console-output/selectors/messages");
 const MessageContainer = createFactory(require("devtools/client/webconsole/new-console-output/components/message-container").MessageContainer);
 
 const ConsoleOutput = createClass({
 
   propTypes: {
     jsterm: PropTypes.object.isRequired,
-    // This function is created in mergeProps
-    openVariablesView: PropTypes.func.isRequired,
-    messages: PropTypes.array.isRequired
+    messages: PropTypes.object.isRequired
   },
 
   displayName: "ConsoleOutput",
 
   componentWillUpdate() {
     let node = ReactDOM.findDOMNode(this);
     if (node.lastChild) {
       this.shouldScrollBottom = isScrolledToBottom(node.lastChild, node);
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
@@ -0,0 +1,9 @@
+[DEFAULT]
+tags = devtools
+subsuite = devtools
+support-files =
+  head.js
+  !/devtools/client/framework/test/shared-head.js
+  test-console.html
+
+[browser_webconsole_init.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_init.js
@@ -0,0 +1,23 @@
+/* -*- 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";
+
+const TEST_URI = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/mochitest/test-console.html";
+
+add_task(function* () {
+  let toolbox = yield openNewTabAndToolbox(TEST_URI, "webconsole");
+  let ui = toolbox.getCurrentPanel().hud.ui;
+
+  ok(ui.jsterm, "jsterm exists");
+  ok(ui.newConsoleOutput, "newConsoleOutput exists");
+
+  // @TODO: fix proptype errors and actually emit 'new-messages' event
+  // let receivedLog = ui.once("new-messages");
+  // yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
+  //   content.wrappedJSObject.doLogs();
+  // });
+  // yield receivedLog;
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/head.js
@@ -0,0 +1,18 @@
+/* -*- 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/ */
+/* import-globals-from ../../../../framework/test/shared-head.js */
+
+"use strict";
+
+// shared-head.js handles imports, constants, and utility functions
+// Load the shared-head file first.
+Services.scriptloader.loadSubScript(
+  "chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js",
+  this);
+
+Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", true);
+registerCleanupFunction(() => {
+  Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/test-console.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title>Simple webconsole test page</title>
+  </head>
+  <body>
+    <p>Simple webconsole test page</p>
+    <script>
+      function doLogs(num) {
+        num = num || 1;
+        for (var i = 0; i < num; i++) {
+          console.log(i);
+        }
+      }
+    </script>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/moz.build
@@ -0,0 +1,14 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+BROWSER_CHROME_MANIFESTS += ['mochitest/browser.ini']
+
+DIRS += [
+    'fixtures'
+]
+
+MOCHITEST_CHROME_MANIFESTS += [
+  'chrome/chrome.ini'
+]