Bug 1313688 - Fail a test if stubs don't match stubs created by stub generators; r=jdescottes
authorNicolas Chevobbe <chevobbe.nicolas@gmail.com>
Fri, 17 Feb 2017 08:08:06 +0100
changeset 372720 0d7b8fb5255ec4a872e39bc8dd556cccde146a51
parent 372719 99ef9fe1494c1117de0217892f74e4a5f42bbdf3
child 372721 2a7f99800581248d32956b95cd844e4e130d2980
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1313688
milestone54.0a1
Bug 1313688 - Fail a test if stubs don't match stubs created by stub generators; r=jdescottes MozReview-Commit-ID: 2HTA4SwyXDi
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser.ini
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_console_api.js
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_css_message.js
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_evaluation_result.js
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_network_event.js
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_page_error.js
--- a/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser.ini
+++ b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser.ini
@@ -1,18 +1,24 @@
 [DEFAULT]
 tags = devtools
 subsuite = devtools
 support-files =
   head.js
   !/devtools/client/framework/test/shared-head.js
+  ../stubs/*
   test-console-api.html
   test-css-message.html
   test-network-event.html
 
+[browser_webconsole_check_stubs_console_api.js]
+[browser_webconsole_check_stubs_css_message.js]
+[browser_webconsole_check_stubs_evaluation_result.js]
+[browser_webconsole_check_stubs_network_event.js]
+[browser_webconsole_check_stubs_page_error.js]
 [browser_webconsole_update_stubs_console_api.js]
 skip-if=true # This is only used to update stubs. It is not an actual test.
 [browser_webconsole_update_stubs_css_message.js]
 skip-if=true # This is only used to update stubs. It is not an actual test.
 [browser_webconsole_update_stubs_evaluation_result.js]
 skip-if=true # This is only used to update stubs. It is not an actual test.
 [browser_webconsole_update_stubs_network_event.js]
 skip-if=true # This is only used to update stubs. It is not an actual test.
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_console_api.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";
+
+Cu.import("resource://gre/modules/osfile.jsm", {});
+
+add_task(function* () {
+  let generatedStubs = yield generateConsoleApiStubs();
+
+  let repoStubFilePath = getTestFilePath("../stubs/consoleApi.js");
+  let repoStubFileContent = yield OS.File.read(repoStubFilePath, { encoding: "utf-8" });
+
+  if (generatedStubs != repoStubFileContent) {
+    ok(false, "The consoleApi stubs file needs to be updated by running " +
+      "`mach test devtools/client/webconsole/new-console-output/test/fixtures/" +
+      "stub-generators/browser_webconsole_update_stubs_console_api.js`");
+  } else {
+    ok(true, "The consoleApi stubs file is up to date");
+  }
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_css_message.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";
+
+Cu.import("resource://gre/modules/osfile.jsm", {});
+
+add_task(function* () {
+  let generatedStubs = yield generateCssMessageStubs();
+
+  let repoStubFilePath = getTestFilePath("../stubs/cssMessage.js");
+  let repoStubFileContent = yield OS.File.read(repoStubFilePath, { encoding: "utf-8" });
+
+  if (generatedStubs != repoStubFileContent) {
+    ok(false, "The cssMessage stubs file needs to be updated by running " +
+      "`mach test devtools/client/webconsole/new-console-output/test/fixtures/" +
+      "stub-generators/browser_webconsole_update_stubs_css_message.js`");
+  } else {
+    ok(true, "The cssMessage stubs file is up to date");
+  }
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_evaluation_result.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";
+
+Cu.import("resource://gre/modules/osfile.jsm", {});
+
+add_task(function* () {
+  let generatedStubs = yield generateEvaluationResultStubs();
+
+  let repoStubFilePath = getTestFilePath("../stubs/evaluationResult.js");
+  let repoStubFileContent = yield OS.File.read(repoStubFilePath, { encoding: "utf-8" });
+
+  if (generatedStubs != repoStubFileContent) {
+    ok(false, "The evaluationResult stubs file needs to be updated by running " +
+      "`mach test devtools/client/webconsole/new-console-output/test/fixtures/" +
+      "stub-generators/browser_webconsole_update_stubs_evaluation_result.js`");
+  } else {
+    ok(true, "The evaluationResult stubs file is up to date");
+  }
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_network_event.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";
+
+Cu.import("resource://gre/modules/osfile.jsm", {});
+
+add_task(function* () {
+  let generatedStubs = yield generateNetworkEventStubs();
+
+  let repoStubFilePath = getTestFilePath("../stubs/networkEvent.js");
+  let repoStubFileContent = yield OS.File.read(repoStubFilePath, { encoding: "utf-8" });
+
+  if (generatedStubs != repoStubFileContent) {
+    ok(false, "The networkEvent stubs file needs to be updated by running " +
+      "`mach test devtools/client/webconsole/new-console-output/test/fixtures/" +
+      "stub-generators/browser_webconsole_update_stubs_network_event.js`");
+  } else {
+    ok(true, "The networkEvent stubs file is up to date");
+  }
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_check_stubs_page_error.js
@@ -0,0 +1,29 @@
+/* -*- 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";
+
+Cu.import("resource://gre/modules/osfile.jsm", {});
+
+add_task(function* () {
+  // On e10s, the exception is triggered in child process
+  // and is ignored by test harness
+  if (!Services.appinfo.browserTabsRemoteAutostart) {
+    expectUncaughtException();
+  }
+
+  let generatedStubs = yield generatePageErrorStubs();
+
+  let repoStubFilePath = getTestFilePath("../stubs/pageError.js");
+  let repoStubFileContent = yield OS.File.read(repoStubFilePath, { encoding: "utf-8" });
+
+  if (generatedStubs != repoStubFileContent) {
+    ok(false, "The pageError stubs file needs to be updated by running " +
+      "`mach test devtools/client/webconsole/new-console-output/test/fixtures/" +
+      "stub-generators/browser_webconsole_update_stubs_page_error.js`");
+  } else {
+    ok(true, "The pageError stubs file is up to date");
+  }
+});