bug 1570378: remote: add bc test helper setup() for empty documents r=remote-protocol-reviewers,jdescottes
☠☠ backed out by 4f81a4f40f88 ☠ ☠
authorAndreas Tolfsen <ato@sny.no>
Fri, 02 Aug 2019 16:29:35 +0000
changeset 486163 412894c27fa28f945f0f364bb5aeab28e673830b
parent 486162 adb3dec1090b16e0acd3792c5a4dc1e2a6401c3f
child 486164 ba13ac52e22a0c8fce78312520418dd2bae349ac
push id36391
push usermalexandru@mozilla.com
push dateMon, 05 Aug 2019 15:55:27 +0000
treeherdermozilla-central@9c91b33629b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersremote-protocol-reviewers, jdescottes
bugs1570378
milestone70.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 1570378: remote: add bc test helper setup() for empty documents r=remote-protocol-reviewers,jdescottes For many browser-chrome (bc) tests is does not matter what the document is, as long as it is does not cause state to bleed over from the previous test. For these cases this patch introduces a shorthand, setup(), which calls setupForURL(url) with an empty document generated by toDataURL(""). Differential Revision: https://phabricator.services.mozilla.com/D40216
remote/test/browser/browser_runtime_callFunctionOn.js
remote/test/browser/browser_runtime_get_properties.js
remote/test/browser/browser_runtime_remote_objects.js
remote/test/browser/head.js
--- a/remote/test/browser/browser_runtime_callFunctionOn.js
+++ b/remote/test/browser/browser_runtime_callFunctionOn.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test the Runtime.callFunctionOn
 // See also browser_runtime_evaluate, which covers basic usages of this method.
 
 add_task(async function() {
-  const { client } = await setupForURL(toDataURL(""));
+  const { client } = await setup();
 
   const firstContext = await testRuntimeEnable(client);
   const contextId = firstContext.id;
   await testObjectReferences(client, contextId);
   await testExceptions(client, contextId);
   await testReturnByValue(client, contextId);
   await testAwaitPromise(client, contextId);
   await testObjectId(client, contextId);
--- a/remote/test/browser/browser_runtime_get_properties.js
+++ b/remote/test/browser/browser_runtime_get_properties.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test the Runtime remote object
 
 add_task(async function() {
-  const { client } = await setupForURL(toDataURL(""));
+  const { client } = await setup();
 
   const firstContext = await testRuntimeEnable(client);
   const contextId = firstContext.id;
 
   await testGetOwnSimpleProperties(client, contextId);
   await testGetCustomProperty(client, contextId);
   await testGetPrototypeProperties(client, contextId);
   await testGetGetterSetterProperties(client, contextId);
--- a/remote/test/browser/browser_runtime_remote_objects.js
+++ b/remote/test/browser/browser_runtime_remote_objects.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test the Runtime remote object
 
 add_task(async function() {
-  const { client } = await setupForURL(toDataURL(""));
+  const { client } = await setup();
 
   const firstContext = await testRuntimeEnable(client);
   const contextId = firstContext.id;
 
   await testObjectRelease(client, contextId);
 
   await client.close();
   ok(true, "The client is closed");
--- a/remote/test/browser/head.js
+++ b/remote/test/browser/head.js
@@ -97,16 +97,24 @@ function getTargets(CDP) {
         return;
       }
       resolve(targets);
     });
   });
 }
 
 /**
+ * Set up test environment in same fashion as setupForURL(),
+ * except using an empty document.
+ */
+async function setup() {
+  return setupForURL(toDataURL(""));
+}
+
+/**
  * Set up test environment by starting the remote agent, connecting
  * the CDP client over loopback, and creating a fresh tab to avoid
  * state bleedover from previous test.
  */
 async function setupForURL(url) {
   const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
 
   await RemoteAgent.listen(Services.io.newURI("http://localhost:9222"));