Bug 1325401 - extract reps chrome mochitests to a dedicated folder;r=jlast
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 17 Jan 2017 16:07:48 +0100
changeset 377194 03792b9efb644ad2497921c434c4362561bf478e
parent 377193 50aca7a3d25305d62c4933e9951811f5740e8fa3
child 377195 f3db78764c55ca4d581002c99a2430e7f068660b
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1325401
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1325401 - extract reps chrome mochitests to a dedicated folder;r=jlast MozReview-Commit-ID: 1fqARH9N4sd
devtools/client/shared/components/reps/moz.build
devtools/client/shared/components/reps/test/mochitest/.eslintrc.js
devtools/client/shared/components/reps/test/mochitest/chrome.ini
devtools/client/shared/components/reps/test/mochitest/head.js
devtools/client/shared/components/reps/test/mochitest/test_reps_array.html
devtools/client/shared/components/reps/test/mochitest/test_reps_attribute.html
devtools/client/shared/components/reps/test/mochitest/test_reps_comment-node.html
devtools/client/shared/components/reps/test/mochitest/test_reps_date-time.html
devtools/client/shared/components/reps/test/mochitest/test_reps_document.html
devtools/client/shared/components/reps/test/mochitest/test_reps_element-node.html
devtools/client/shared/components/reps/test/mochitest/test_reps_error.html
devtools/client/shared/components/reps/test/mochitest/test_reps_event.html
devtools/client/shared/components/reps/test/mochitest/test_reps_failure.html
devtools/client/shared/components/reps/test/mochitest/test_reps_function.html
devtools/client/shared/components/reps/test/mochitest/test_reps_grip-array.html
devtools/client/shared/components/reps/test/mochitest/test_reps_grip-map.html
devtools/client/shared/components/reps/test/mochitest/test_reps_grip.html
devtools/client/shared/components/reps/test/mochitest/test_reps_infinity.html
devtools/client/shared/components/reps/test/mochitest/test_reps_long-string.html
devtools/client/shared/components/reps/test/mochitest/test_reps_nan.html
devtools/client/shared/components/reps/test/mochitest/test_reps_null.html
devtools/client/shared/components/reps/test/mochitest/test_reps_number.html
devtools/client/shared/components/reps/test/mochitest/test_reps_object-with-text.html
devtools/client/shared/components/reps/test/mochitest/test_reps_object-with-url.html
devtools/client/shared/components/reps/test/mochitest/test_reps_object.html
devtools/client/shared/components/reps/test/mochitest/test_reps_promise.html
devtools/client/shared/components/reps/test/mochitest/test_reps_regexp.html
devtools/client/shared/components/reps/test/mochitest/test_reps_string.html
devtools/client/shared/components/reps/test/mochitest/test_reps_stylesheet.html
devtools/client/shared/components/reps/test/mochitest/test_reps_symbol.html
devtools/client/shared/components/reps/test/mochitest/test_reps_text-node.html
devtools/client/shared/components/reps/test/mochitest/test_reps_undefined.html
devtools/client/shared/components/reps/test/mochitest/test_reps_window.html
devtools/client/shared/components/test/mochitest/chrome.ini
devtools/client/shared/components/test/mochitest/head.js
devtools/client/shared/components/test/mochitest/test_reps_array.html
devtools/client/shared/components/test/mochitest/test_reps_attribute.html
devtools/client/shared/components/test/mochitest/test_reps_comment-node.html
devtools/client/shared/components/test/mochitest/test_reps_date-time.html
devtools/client/shared/components/test/mochitest/test_reps_document.html
devtools/client/shared/components/test/mochitest/test_reps_element-node.html
devtools/client/shared/components/test/mochitest/test_reps_error.html
devtools/client/shared/components/test/mochitest/test_reps_event.html
devtools/client/shared/components/test/mochitest/test_reps_failure.html
devtools/client/shared/components/test/mochitest/test_reps_function.html
devtools/client/shared/components/test/mochitest/test_reps_grip-array.html
devtools/client/shared/components/test/mochitest/test_reps_grip-map.html
devtools/client/shared/components/test/mochitest/test_reps_grip.html
devtools/client/shared/components/test/mochitest/test_reps_infinity.html
devtools/client/shared/components/test/mochitest/test_reps_long-string.html
devtools/client/shared/components/test/mochitest/test_reps_nan.html
devtools/client/shared/components/test/mochitest/test_reps_null.html
devtools/client/shared/components/test/mochitest/test_reps_number.html
devtools/client/shared/components/test/mochitest/test_reps_object-with-text.html
devtools/client/shared/components/test/mochitest/test_reps_object-with-url.html
devtools/client/shared/components/test/mochitest/test_reps_object.html
devtools/client/shared/components/test/mochitest/test_reps_promise.html
devtools/client/shared/components/test/mochitest/test_reps_regexp.html
devtools/client/shared/components/test/mochitest/test_reps_string.html
devtools/client/shared/components/test/mochitest/test_reps_stylesheet.html
devtools/client/shared/components/test/mochitest/test_reps_symbol.html
devtools/client/shared/components/test/mochitest/test_reps_text-node.html
devtools/client/shared/components/test/mochitest/test_reps_undefined.html
devtools/client/shared/components/test/mochitest/test_reps_window.html
--- a/devtools/client/shared/components/reps/moz.build
+++ b/devtools/client/shared/components/reps/moz.build
@@ -37,8 +37,10 @@ DevToolsModules(
     'reps.js',
     'string.js',
     'stylesheet.js',
     'symbol.js',
     'text-node.js',
     'undefined.js',
     'window.js',
 )
+
+MOCHITEST_CHROME_MANIFESTS += ['test/mochitest/chrome.ini']
new file mode 100644
--- /dev/null
+++ b/devtools/client/shared/components/reps/test/mochitest/.eslintrc.js
@@ -0,0 +1,6 @@
+"use strict";
+
+module.exports = {
+  // Extend from the shared list of defined globals for mochitests.
+  "extends": "../../../../../../.eslintrc.mochitests.js"
+};
new file mode 100644
--- /dev/null
+++ b/devtools/client/shared/components/reps/test/mochitest/chrome.ini
@@ -0,0 +1,33 @@
+[DEFAULT]
+support-files =
+  head.js
+
+[test_reps_array.html]
+[test_reps_attribute.html]
+[test_reps_comment-node.html]
+[test_reps_date-time.html]
+[test_reps_document.html]
+[test_reps_element-node.html]
+[test_reps_error.html]
+[test_reps_event.html]
+[test_reps_failure.html]
+[test_reps_function.html]
+[test_reps_grip.html]
+[test_reps_grip-array.html]
+[test_reps_grip-map.html]
+[test_reps_infinity.html]
+[test_reps_long-string.html]
+[test_reps_nan.html]
+[test_reps_null.html]
+[test_reps_number.html]
+[test_reps_object.html]
+[test_reps_object-with-text.html]
+[test_reps_object-with-url.html]
+[test_reps_promise.html]
+[test_reps_regexp.html]
+[test_reps_string.html]
+[test_reps_stylesheet.html]
+[test_reps_symbol.html]
+[test_reps_text-node.html]
+[test_reps_undefined.html]
+[test_reps_window.html]
\ No newline at end of file
copy from devtools/client/shared/components/test/mochitest/head.js
copy to devtools/client/shared/components/reps/test/mochitest/head.js
--- a/devtools/client/shared/components/test/mochitest/head.js
+++ b/devtools/client/shared/components/reps/test/mochitest/head.js
@@ -6,183 +6,29 @@
 "use strict";
 
 var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
 
 var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 var { Assert } = require("resource://testing-common/Assert.jsm");
 var { gDevTools } = require("devtools/client/framework/devtools");
 var { BrowserLoader } = Cu.import("resource://devtools/client/shared/browser-loader.js", {});
-var promise = require("promise");
-var defer = require("devtools/shared/defer");
-var Services = require("Services");
-var { DebuggerServer } = require("devtools/server/main");
-var { DebuggerClient } = require("devtools/shared/client/main");
-var DevToolsUtils = require("devtools/shared/DevToolsUtils");
 var flags = require("devtools/shared/flags");
 var { Task } = require("devtools/shared/task");
-var { TargetFactory } = require("devtools/client/framework/target");
-var { Toolbox } = require("devtools/client/framework/toolbox");
 
 flags.testing = true;
 var { require: browserRequire } = BrowserLoader({
   baseURI: "resource://devtools/client/shared/",
   window
 });
 
 let ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
 let React = browserRequire("devtools/client/shared/vendor/react");
 var TestUtils = React.addons.TestUtils;
 
-var EXAMPLE_URL = "http://example.com/browser/browser/devtools/shared/test/";
-
-function forceRender(comp) {
-  return setState(comp, {})
-    .then(() => setState(comp, {}));
-}
-
-// All tests are asynchronous.
-SimpleTest.waitForExplicitFinish();
-
-function onNextAnimationFrame(fn) {
-  return () =>
-    requestAnimationFrame(() =>
-      requestAnimationFrame(fn));
-}
-
-function setState(component, newState) {
-  return new Promise(resolve => {
-    component.setState(newState, onNextAnimationFrame(resolve));
-  });
-}
-
-function dumpn(msg) {
-  dump(`SHARED-COMPONENTS-TEST: ${msg}\n`);
-}
-
-/**
- * Tree
- */
-
-var TEST_TREE_INTERFACE = {
-  getParent: x => TEST_TREE.parent[x],
-  getChildren: x => TEST_TREE.children[x],
-  renderItem: (x, depth, focused) => "-".repeat(depth) + x + ":" + focused + "\n",
-  getRoots: () => ["A", "M"],
-  getKey: x => "key-" + x,
-  itemHeight: 1,
-  onExpand: x => TEST_TREE.expanded.add(x),
-  onCollapse: x => TEST_TREE.expanded.delete(x),
-  isExpanded: x => TEST_TREE.expanded.has(x),
-};
-
-function isRenderedTree(actual, expectedDescription, msg) {
-  const expected = expectedDescription.map(x => x + "\n").join("");
-  dumpn(`Expected tree:\n${expected}`);
-  dumpn(`Actual tree:\n${actual}`);
-  is(actual, expected, msg);
-}
-
-// Encoding of the following tree/forest:
-//
-// A
-// |-- B
-// |   |-- E
-// |   |   |-- K
-// |   |   `-- L
-// |   |-- F
-// |   `-- G
-// |-- C
-// |   |-- H
-// |   `-- I
-// `-- D
-//     `-- J
-// M
-// `-- N
-//     `-- O
-var TEST_TREE = {
-  children: {
-    A: ["B", "C", "D"],
-    B: ["E", "F", "G"],
-    C: ["H", "I"],
-    D: ["J"],
-    E: ["K", "L"],
-    F: [],
-    G: [],
-    H: [],
-    I: [],
-    J: [],
-    K: [],
-    L: [],
-    M: ["N"],
-    N: ["O"],
-    O: []
-  },
-  parent: {
-    A: null,
-    B: "A",
-    C: "A",
-    D: "A",
-    E: "B",
-    F: "B",
-    G: "B",
-    H: "C",
-    I: "C",
-    J: "D",
-    K: "E",
-    L: "E",
-    M: null,
-    N: "M",
-    O: "N"
-  },
-  expanded: new Set(),
-};
-
-/**
- * Frame
- */
-function checkFrameString({
-  el, file, line, column, source, functionName, shouldLink, tooltip
-}) {
-  let $ = selector => el.querySelector(selector);
-
-  let $func = $(".frame-link-function-display-name");
-  let $source = $(".frame-link-source");
-  let $sourceInner = $(".frame-link-source-inner");
-  let $filename = $(".frame-link-filename");
-  let $line = $(".frame-link-line");
-
-  is($filename.textContent, file, "Correct filename");
-  is(el.getAttribute("data-line"), line ? `${line}` : null, "Expected `data-line` found");
-  is(el.getAttribute("data-column"),
-     column ? `${column}` : null, "Expected `data-column` found");
-  is($sourceInner.getAttribute("title"), tooltip, "Correct tooltip");
-  is($source.tagName, shouldLink ? "A" : "SPAN", "Correct linkable status");
-  if (shouldLink) {
-    is($source.getAttribute("href"), source, "Correct source");
-  }
-
-  if (line != null) {
-    let lineText = `:${line}`;
-    if (column != null) {
-      lineText += `:${column}`;
-    }
-
-    is($line.textContent, lineText, "Correct line number");
-  } else {
-    ok(!$line, "Should not have an element for `line`");
-  }
-
-  if (functionName != null) {
-    is($func.textContent, functionName, "Correct function name");
-  } else {
-    ok(!$func, "Should not have an element for `functionName`");
-  }
-}
-
 function renderComponent(component, props) {
   const el = React.createElement(component, props, {});
   // By default, renderIntoDocument() won't work for stateless components, but
   // it will work if the stateless component is wrapped in a stateful one.
   // See https://github.com/facebook/react/issues/4839
   const wrappedEl = React.DOM.span({}, [el]);
   const renderedComponent = TestUtils.renderIntoDocument(wrappedEl);
   return ReactDOM.findDOMNode(renderedComponent).children[0];
rename from devtools/client/shared/components/test/mochitest/test_reps_array.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_array.html
rename from devtools/client/shared/components/test/mochitest/test_reps_attribute.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_attribute.html
rename from devtools/client/shared/components/test/mochitest/test_reps_comment-node.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_comment-node.html
rename from devtools/client/shared/components/test/mochitest/test_reps_date-time.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_date-time.html
rename from devtools/client/shared/components/test/mochitest/test_reps_document.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_document.html
rename from devtools/client/shared/components/test/mochitest/test_reps_element-node.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_element-node.html
rename from devtools/client/shared/components/test/mochitest/test_reps_error.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_error.html
rename from devtools/client/shared/components/test/mochitest/test_reps_event.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_event.html
rename from devtools/client/shared/components/test/mochitest/test_reps_failure.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_failure.html
rename from devtools/client/shared/components/test/mochitest/test_reps_function.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_function.html
rename from devtools/client/shared/components/test/mochitest/test_reps_grip-array.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_grip-array.html
rename from devtools/client/shared/components/test/mochitest/test_reps_grip-map.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_grip-map.html
rename from devtools/client/shared/components/test/mochitest/test_reps_grip.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_grip.html
rename from devtools/client/shared/components/test/mochitest/test_reps_infinity.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_infinity.html
rename from devtools/client/shared/components/test/mochitest/test_reps_long-string.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_long-string.html
rename from devtools/client/shared/components/test/mochitest/test_reps_nan.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_nan.html
rename from devtools/client/shared/components/test/mochitest/test_reps_null.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_null.html
rename from devtools/client/shared/components/test/mochitest/test_reps_number.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_number.html
rename from devtools/client/shared/components/test/mochitest/test_reps_object-with-text.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_object-with-text.html
rename from devtools/client/shared/components/test/mochitest/test_reps_object-with-url.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_object-with-url.html
rename from devtools/client/shared/components/test/mochitest/test_reps_object.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_object.html
rename from devtools/client/shared/components/test/mochitest/test_reps_promise.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_promise.html
rename from devtools/client/shared/components/test/mochitest/test_reps_regexp.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_regexp.html
rename from devtools/client/shared/components/test/mochitest/test_reps_string.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_string.html
rename from devtools/client/shared/components/test/mochitest/test_reps_stylesheet.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_stylesheet.html
rename from devtools/client/shared/components/test/mochitest/test_reps_symbol.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_symbol.html
rename from devtools/client/shared/components/test/mochitest/test_reps_text-node.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_text-node.html
rename from devtools/client/shared/components/test/mochitest/test_reps_undefined.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_undefined.html
rename from devtools/client/shared/components/test/mochitest/test_reps_window.html
rename to devtools/client/shared/components/reps/test/mochitest/test_reps_window.html
--- a/devtools/client/shared/components/test/mochitest/chrome.ini
+++ b/devtools/client/shared/components/test/mochitest/chrome.ini
@@ -2,45 +2,16 @@
 support-files =
   head.js
 
 [test_frame_01.html]
 [test_HSplitBox_01.html]
 [test_notification_box_01.html]
 [test_notification_box_02.html]
 [test_notification_box_03.html]
-[test_reps_array.html]
-[test_reps_attribute.html]
-[test_reps_comment-node.html]
-[test_reps_date-time.html]
-[test_reps_document.html]
-[test_reps_element-node.html]
-[test_reps_error.html]
-[test_reps_event.html]
-[test_reps_failure.html]
-[test_reps_function.html]
-[test_reps_grip.html]
-[test_reps_grip-array.html]
-[test_reps_grip-map.html]
-[test_reps_infinity.html]
-[test_reps_long-string.html]
-[test_reps_nan.html]
-[test_reps_null.html]
-[test_reps_number.html]
-[test_reps_object.html]
-[test_reps_object-with-text.html]
-[test_reps_object-with-url.html]
-[test_reps_promise.html]
-[test_reps_regexp.html]
-[test_reps_string.html]
-[test_reps_stylesheet.html]
-[test_reps_symbol.html]
-[test_reps_text-node.html]
-[test_reps_undefined.html]
-[test_reps_window.html]
 [test_sidebar_toggle.html]
 [test_stack-trace.html]
 [test_tabs_accessibility.html]
 [test_tabs_menu.html]
 [test_tree_01.html]
 [test_tree_02.html]
 [test_tree_03.html]
 [test_tree_04.html]
--- a/devtools/client/shared/components/test/mochitest/head.js
+++ b/devtools/client/shared/components/test/mochitest/head.js
@@ -189,23 +189,8 @@ function renderComponent(component, prop
 }
 
 function shallowRenderComponent(component, props) {
   const el = React.createElement(component, props);
   const renderer = TestUtils.createRenderer();
   renderer.render(el, {});
   return renderer.getRenderOutput();
 }
-
-/**
- * Test that a rep renders correctly across different modes.
- */
-function testRepRenderModes(modeTests, testName, componentUnderTest, gripStub) {
-  modeTests.forEach(({mode, expectedOutput, message}) => {
-    const modeString = typeof mode === "undefined" ? "no mode" : mode.toString();
-    if (!message) {
-      message = `${testName}: ${modeString} renders correctly.`;
-    }
-
-    const rendered = renderComponent(componentUnderTest.rep, { object: gripStub, mode });
-    is(rendered.textContent, expectedOutput, message);
-  });
-}