Bug 1325401 - extract reps chrome mochitests to a dedicated folder;r=jlast draft
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 17 Jan 2017 16:07:48 +0100
changeset 462481 d0ef38a6d255f03a077dc99b7154172448cc9438
parent 461355 0ece1f2bb36b5eabe9213c6ecd1a0c9e8fae79ee
child 542409 629d7f4491169a16278a3e7ca2832fd0f54621f5
push id41768
push userjdescottes@mozilla.com
push dateTue, 17 Jan 2017 15:12:04 +0000
reviewersjlast
bugs1325401
milestone53.0a1
Bug 1325401 - extract reps chrome mochitests to a dedicated folder;r=jlast MozReview-Commit-ID: 1fqARH9N4sd
devtools/client/shared/components/moz.build
devtools/client/shared/components/test/mochitest/chrome.ini
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
devtools/client/shared/components/test/reps/.eslintrc.js
devtools/client/shared/components/test/reps/chrome.ini
devtools/client/shared/components/test/reps/head.js
devtools/client/shared/components/test/reps/test_reps_array.html
devtools/client/shared/components/test/reps/test_reps_attribute.html
devtools/client/shared/components/test/reps/test_reps_comment-node.html
devtools/client/shared/components/test/reps/test_reps_date-time.html
devtools/client/shared/components/test/reps/test_reps_document.html
devtools/client/shared/components/test/reps/test_reps_element-node.html
devtools/client/shared/components/test/reps/test_reps_error.html
devtools/client/shared/components/test/reps/test_reps_event.html
devtools/client/shared/components/test/reps/test_reps_failure.html
devtools/client/shared/components/test/reps/test_reps_function.html
devtools/client/shared/components/test/reps/test_reps_grip-array.html
devtools/client/shared/components/test/reps/test_reps_grip-map.html
devtools/client/shared/components/test/reps/test_reps_grip.html
devtools/client/shared/components/test/reps/test_reps_infinity.html
devtools/client/shared/components/test/reps/test_reps_long-string.html
devtools/client/shared/components/test/reps/test_reps_nan.html
devtools/client/shared/components/test/reps/test_reps_null.html
devtools/client/shared/components/test/reps/test_reps_number.html
devtools/client/shared/components/test/reps/test_reps_object-with-text.html
devtools/client/shared/components/test/reps/test_reps_object-with-url.html
devtools/client/shared/components/test/reps/test_reps_object.html
devtools/client/shared/components/test/reps/test_reps_promise.html
devtools/client/shared/components/test/reps/test_reps_regexp.html
devtools/client/shared/components/test/reps/test_reps_string.html
devtools/client/shared/components/test/reps/test_reps_stylesheet.html
devtools/client/shared/components/test/reps/test_reps_symbol.html
devtools/client/shared/components/test/reps/test_reps_text-node.html
devtools/client/shared/components/test/reps/test_reps_undefined.html
devtools/client/shared/components/test/reps/test_reps_window.html
--- a/devtools/client/shared/components/moz.build
+++ b/devtools/client/shared/components/moz.build
@@ -21,10 +21,13 @@ DevToolsModules(
     'reps.js',
     'search-box.js',
     'sidebar-toggle.css',
     'sidebar-toggle.js',
     'stack-trace.js',
     'tree.js',
 )
 
-MOCHITEST_CHROME_MANIFESTS += ['test/mochitest/chrome.ini']
+MOCHITEST_CHROME_MANIFESTS += [
+    'test/mochitest/chrome.ini',
+    'test/reps/chrome.ini',
+]
 BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
--- 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]
new file mode 100644
--- /dev/null
+++ b/devtools/client/shared/components/test/reps/.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/test/reps/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/test/reps/head.js
--- a/devtools/client/shared/components/test/mochitest/head.js
+++ b/devtools/client/shared/components/test/reps/head.js
@@ -29,160 +29,16 @@ var { require: browserRequire } = Browse
 });
 
 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/test/reps/test_reps_array.html
rename from devtools/client/shared/components/test/mochitest/test_reps_attribute.html
rename to devtools/client/shared/components/test/reps/test_reps_attribute.html
rename from devtools/client/shared/components/test/mochitest/test_reps_comment-node.html
rename to devtools/client/shared/components/test/reps/test_reps_comment-node.html
rename from devtools/client/shared/components/test/mochitest/test_reps_date-time.html
rename to devtools/client/shared/components/test/reps/test_reps_date-time.html
rename from devtools/client/shared/components/test/mochitest/test_reps_document.html
rename to devtools/client/shared/components/test/reps/test_reps_document.html
rename from devtools/client/shared/components/test/mochitest/test_reps_element-node.html
rename to devtools/client/shared/components/test/reps/test_reps_element-node.html
rename from devtools/client/shared/components/test/mochitest/test_reps_error.html
rename to devtools/client/shared/components/test/reps/test_reps_error.html
rename from devtools/client/shared/components/test/mochitest/test_reps_event.html
rename to devtools/client/shared/components/test/reps/test_reps_event.html
rename from devtools/client/shared/components/test/mochitest/test_reps_failure.html
rename to devtools/client/shared/components/test/reps/test_reps_failure.html
rename from devtools/client/shared/components/test/mochitest/test_reps_function.html
rename to devtools/client/shared/components/test/reps/test_reps_function.html
rename from devtools/client/shared/components/test/mochitest/test_reps_grip-array.html
rename to devtools/client/shared/components/test/reps/test_reps_grip-array.html
rename from devtools/client/shared/components/test/mochitest/test_reps_grip-map.html
rename to devtools/client/shared/components/test/reps/test_reps_grip-map.html
rename from devtools/client/shared/components/test/mochitest/test_reps_grip.html
rename to devtools/client/shared/components/test/reps/test_reps_grip.html
rename from devtools/client/shared/components/test/mochitest/test_reps_infinity.html
rename to devtools/client/shared/components/test/reps/test_reps_infinity.html
rename from devtools/client/shared/components/test/mochitest/test_reps_long-string.html
rename to devtools/client/shared/components/test/reps/test_reps_long-string.html
rename from devtools/client/shared/components/test/mochitest/test_reps_nan.html
rename to devtools/client/shared/components/test/reps/test_reps_nan.html
rename from devtools/client/shared/components/test/mochitest/test_reps_null.html
rename to devtools/client/shared/components/test/reps/test_reps_null.html
rename from devtools/client/shared/components/test/mochitest/test_reps_number.html
rename to devtools/client/shared/components/test/reps/test_reps_number.html
rename from devtools/client/shared/components/test/mochitest/test_reps_object-with-text.html
rename to devtools/client/shared/components/test/reps/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/test/reps/test_reps_object-with-url.html
rename from devtools/client/shared/components/test/mochitest/test_reps_object.html
rename to devtools/client/shared/components/test/reps/test_reps_object.html
rename from devtools/client/shared/components/test/mochitest/test_reps_promise.html
rename to devtools/client/shared/components/test/reps/test_reps_promise.html
rename from devtools/client/shared/components/test/mochitest/test_reps_regexp.html
rename to devtools/client/shared/components/test/reps/test_reps_regexp.html
rename from devtools/client/shared/components/test/mochitest/test_reps_string.html
rename to devtools/client/shared/components/test/reps/test_reps_string.html
rename from devtools/client/shared/components/test/mochitest/test_reps_stylesheet.html
rename to devtools/client/shared/components/test/reps/test_reps_stylesheet.html
rename from devtools/client/shared/components/test/mochitest/test_reps_symbol.html
rename to devtools/client/shared/components/test/reps/test_reps_symbol.html
rename from devtools/client/shared/components/test/mochitest/test_reps_text-node.html
rename to devtools/client/shared/components/test/reps/test_reps_text-node.html
rename from devtools/client/shared/components/test/mochitest/test_reps_undefined.html
rename to devtools/client/shared/components/test/reps/test_reps_undefined.html
rename from devtools/client/shared/components/test/mochitest/test_reps_window.html
rename to devtools/client/shared/components/test/reps/test_reps_window.html