Bug 1406294 - Refactor browser/components/resistfingerprinting/test/browser rounded window tests. r=smaug,timhuang
authorChung-Sheng Fu <cfu@mozilla.com>
Fri, 06 Oct 2017 17:59:17 +0800
changeset 386099 0802c1c711efb07623dffe8488c60a1c11b58bfb
parent 386098 f66cb1530f757aa53b7f7d5c91cddbf7af729ad7
child 386100 6796e53fa9e386fd1709ddb2fd45eb74ab4e7b77
push id32675
push userarchaeopteryx@coole-files.de
push dateFri, 13 Oct 2017 21:36:21 +0000
treeherdermozilla-central@684b9ee0468e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, timhuang
bugs1406294
milestone58.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 1406294 - Refactor browser/components/resistfingerprinting/test/browser rounded window tests. r=smaug,timhuang MozReview-Commit-ID: GSUW3zWPF0K
browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_max.js
browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_mid.js
browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_min.js
browser/components/resistfingerprinting/test/browser/browser_roundedWindow_windowSetting_max.js
browser/components/resistfingerprinting/test/browser/browser_roundedWindow_windowSetting_mid.js
browser/components/resistfingerprinting/test/browser/browser_roundedWindow_windowSetting_min.js
browser/components/resistfingerprinting/test/browser/head.js
--- a/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_max.js
+++ b/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_max.js
@@ -1,62 +1,11 @@
 /*
  * Bug 1330882 - A test case for opening new windows through window.open() as
  *   rounded size when fingerprinting resistance is enabled. This test is for
  *   maximum values.
  */
 
-const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
-
-const TEST_DOMAIN = "http://example.net/";
-const TEST_PATH = TEST_DOMAIN + "browser/browser/components/resistfingerprinting/test/browser/";
-
-let gMaxAvailWidth;
-let gMaxAvailHeight;
-
-// We need the chrome UI size of popup windows for testing outerWidth/Height.
-let gPopupChromeUIWidth;
-let gPopupChromeUIHeight;
-
-const TESTCASES = [
-  { settingWidth: 1025, settingHeight: 1050, targetWidth: 1000, targetHeight: 1000 },
-  { settingWidth: 9999, settingHeight: 9999, targetWidth: 1000, targetHeight: 1000 },
-  { settingWidth: 999, settingHeight: 999, targetWidth: 1000, targetHeight: 1000 },
-];
-
-add_task(async function setup() {
-  await SpecialPowers.pushPrefEnv({"set":
-    [["privacy.resistFingerprinting", true]]
-  });
-
-  // Calculate the popup window's chrome UI size for tests of outerWidth/Height.
-  let popUpChromeUISize = await calcPopUpWindowChromeUISize();
-
-  gPopupChromeUIWidth = popUpChromeUISize.chromeWidth;
-  gPopupChromeUIHeight = popUpChromeUISize.chromeHeight;
-
-  // Calculate the maximum available size.
-  let maxAvailSize = await calcMaximumAvailSize(gPopupChromeUIWidth,
-                                                gPopupChromeUIHeight);
-
-  gMaxAvailWidth = maxAvailSize.maxAvailWidth;
-  gMaxAvailHeight = maxAvailSize.maxAvailHeight;
-});
-
-add_task(async function test_window_open() {
-  // Open a tab to test window.open().
-  let tab = await BrowserTestUtils.openNewForegroundTab(
-    gBrowser, TEST_PATH + "file_dummy.html");
-
-  for (let test of TESTCASES) {
-    // Test 'width' and 'height' of window features.
-    await testWindowOpen(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                         test.targetWidth, test.targetHeight, false, gMaxAvailWidth,
-                         gMaxAvailHeight, gPopupChromeUIWidth, gPopupChromeUIHeight);
-
-    // test 'outerWidth' and 'outerHeight' of window features.
-    await testWindowOpen(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                         test.targetWidth, test.targetHeight, true, gMaxAvailWidth,
-                         gMaxAvailHeight, gPopupChromeUIWidth, gPopupChromeUIHeight);
-  }
-
-  await BrowserTestUtils.removeTab(tab);
-});
+OpenTest.run([
+  {settingWidth: 1025, settingHeight: 1050, targetWidth: 1000, targetHeight: 1000},
+  {settingWidth: 9999, settingHeight: 9999, targetWidth: 1000, targetHeight: 1000},
+  {settingWidth: 999, settingHeight: 999, targetWidth: 1000, targetHeight: 1000}
+]);
--- a/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_mid.js
+++ b/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_mid.js
@@ -1,62 +1,11 @@
 /*
  * Bug 1330882 - A test case for opening new windows through window.open() as
  *   rounded size when fingerprinting resistance is enabled. This test is for
  *   middle values.
  */
 
-const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
-
-const TEST_DOMAIN = "http://example.net/";
-const TEST_PATH = TEST_DOMAIN + "browser/browser/components/resistfingerprinting/test/browser/";
-
-let gMaxAvailWidth;
-let gMaxAvailHeight;
-
-// We need the chrome UI size of popup windows for testing outerWidth/Height.
-let gPopupChromeUIWidth;
-let gPopupChromeUIHeight;
-
-const TESTCASES = [
-  { settingWidth: 600, settingHeight: 600, targetWidth: 600, targetHeight: 600 },
-  { settingWidth: 599, settingHeight: 599, targetWidth: 600, targetHeight: 600 },
-  { settingWidth: 401, settingHeight: 501, targetWidth: 600, targetHeight: 600 },
-];
-
-add_task(async function setup() {
-  await SpecialPowers.pushPrefEnv({"set":
-    [["privacy.resistFingerprinting", true]]
-  });
-
-  // Calculate the popup window's chrome UI size for tests of outerWidth/Height.
-  let popUpChromeUISize = await calcPopUpWindowChromeUISize();
-
-  gPopupChromeUIWidth = popUpChromeUISize.chromeWidth;
-  gPopupChromeUIHeight = popUpChromeUISize.chromeHeight;
-
-  // Calculate the maximum available size.
-  let maxAvailSize = await calcMaximumAvailSize(gPopupChromeUIWidth,
-                                                gPopupChromeUIHeight);
-
-  gMaxAvailWidth = maxAvailSize.maxAvailWidth;
-  gMaxAvailHeight = maxAvailSize.maxAvailHeight;
-});
-
-add_task(async function test_window_open() {
-  // Open a tab to test window.open().
-  let tab = await BrowserTestUtils.openNewForegroundTab(
-    gBrowser, TEST_PATH + "file_dummy.html");
-
-  for (let test of TESTCASES) {
-    // Test 'width' and 'height' of window features.
-    await testWindowOpen(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                         test.targetWidth, test.targetHeight, false, gMaxAvailWidth,
-                         gMaxAvailHeight, gPopupChromeUIWidth, gPopupChromeUIHeight);
-
-    // test 'outerWidth' and 'outerHeight' of window features.
-    await testWindowOpen(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                         test.targetWidth, test.targetHeight, true, gMaxAvailWidth,
-                         gMaxAvailHeight, gPopupChromeUIWidth, gPopupChromeUIHeight);
-  }
-
-  await BrowserTestUtils.removeTab(tab);
-});
+OpenTest.run([
+  {settingWidth: 600, settingHeight: 600, targetWidth: 600, targetHeight: 600},
+  {settingWidth: 599, settingHeight: 599, targetWidth: 600, targetHeight: 600},
+  {settingWidth: 401, settingHeight: 501, targetWidth: 600, targetHeight: 600}
+]);
--- a/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_min.js
+++ b/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_min.js
@@ -1,61 +1,10 @@
 /*
  * Bug 1330882 - A test case for opening new windows through window.open() as
  *   rounded size when fingerprinting resistance is enabled. This test is for
  *   minimum values.
  */
 
-const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
-
-const TEST_DOMAIN = "http://example.net/";
-const TEST_PATH = TEST_DOMAIN + "browser/browser/components/resistfingerprinting/test/browser/";
-
-let gMaxAvailWidth;
-let gMaxAvailHeight;
-
-// We need the chrome UI size of popup windows for testing outerWidth/Height.
-let gPopupChromeUIWidth;
-let gPopupChromeUIHeight;
-
-const TESTCASES = [
-  { settingWidth: 199, settingHeight: 99, targetWidth: 200, targetHeight: 100 },
-  { settingWidth: 10, settingHeight: 10, targetWidth: 200, targetHeight: 100 },
-];
-
-add_task(async function setup() {
-  await SpecialPowers.pushPrefEnv({"set":
-    [["privacy.resistFingerprinting", true]]
-  });
-
-  // Calculate the popup window's chrome UI size for tests of outerWidth/Height.
-  let popUpChromeUISize = await calcPopUpWindowChromeUISize();
-
-  gPopupChromeUIWidth = popUpChromeUISize.chromeWidth;
-  gPopupChromeUIHeight = popUpChromeUISize.chromeHeight;
-
-  // Calculate the maximum available size.
-  let maxAvailSize = await calcMaximumAvailSize(gPopupChromeUIWidth,
-                                                gPopupChromeUIHeight);
-
-  gMaxAvailWidth = maxAvailSize.maxAvailWidth;
-  gMaxAvailHeight = maxAvailSize.maxAvailHeight;
-});
-
-add_task(async function test_window_open() {
-  // Open a tab to test window.open().
-  let tab = await BrowserTestUtils.openNewForegroundTab(
-    gBrowser, TEST_PATH + "file_dummy.html");
-
-  for (let test of TESTCASES) {
-    // Test 'width' and 'height' of window features.
-    await testWindowOpen(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                         test.targetWidth, test.targetHeight, false, gMaxAvailWidth,
-                         gMaxAvailHeight, gPopupChromeUIWidth, gPopupChromeUIHeight);
-
-    // test 'outerWidth' and 'outerHeight' of window features.
-    await testWindowOpen(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                         test.targetWidth, test.targetHeight, true, gMaxAvailWidth,
-                         gMaxAvailHeight, gPopupChromeUIWidth, gPopupChromeUIHeight);
-  }
-
-  await BrowserTestUtils.removeTab(tab);
-});
+OpenTest.run([
+  {settingWidth: 199, settingHeight: 99, targetWidth: 200, targetHeight: 100},
+  {settingWidth: 10, settingHeight: 10, targetWidth: 200, targetHeight: 100}
+]);
--- a/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_windowSetting_max.js
+++ b/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_windowSetting_max.js
@@ -1,67 +1,11 @@
 /*
  * Bug 1330882 - A test case for setting window size through window.innerWidth/Height
  *   and window.outerWidth/Height when fingerprinting resistance is enabled. This
  *   test is for maximum values.
  */
 
-const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
-
-const TEST_DOMAIN = "http://example.net/";
-const TEST_PATH = TEST_DOMAIN + "browser/browser/components/resistfingerprinting/test/browser/";
-
-let gMaxAvailWidth;
-let gMaxAvailHeight;
-
-// We need the chrome UI size of popup windows for testing outerWidth/Height.
-let gPopupChromeUIWidth;
-let gPopupChromeUIHeight;
-
-const TESTCASES = [
-  { settingWidth: 1025, settingHeight: 1050, targetWidth: 1000, targetHeight: 1000,
-    initWidth: 200, initHeight: 100 },
-  { settingWidth: 9999, settingHeight: 9999, targetWidth: 1000, targetHeight: 1000,
-    initWidth: 200, initHeight: 100  },
-  { settingWidth: 999, settingHeight: 999, targetWidth: 1000, targetHeight: 1000,
-    initWidth: 200, initHeight: 100  },
-];
-
-add_task(async function setup() {
-  await SpecialPowers.pushPrefEnv({"set":
-    [["privacy.resistFingerprinting", true]]
-  });
-
-  // Calculate the popup window's chrome UI size for tests of outerWidth/Height.
-  let popUpChromeUISize = await calcPopUpWindowChromeUISize();
-
-  gPopupChromeUIWidth = popUpChromeUISize.chromeWidth;
-  gPopupChromeUIHeight = popUpChromeUISize.chromeHeight;
-
-  // Calculate the maximum available size.
-  let maxAvailSize = await calcMaximumAvailSize(gPopupChromeUIWidth,
-                                                gPopupChromeUIHeight);
-
-  gMaxAvailWidth = maxAvailSize.maxAvailWidth;
-  gMaxAvailHeight = maxAvailSize.maxAvailHeight;
-});
-
-add_task(async function test_window_size_setting() {
-  // Open a tab to test.
-  let tab = await BrowserTestUtils.openNewForegroundTab(
-    gBrowser, TEST_PATH + "file_dummy.html");
-
-  for (let test of TESTCASES) {
-    // Test window.innerWidth and window.innerHeight.
-    await testWindowSizeSetting(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                                test.targetWidth, test.targetHeight, test.initWidth,
-                                test.initHeight, false, gMaxAvailWidth, gMaxAvailHeight,
-                                gPopupChromeUIWidth, gPopupChromeUIHeight);
-
-    // test window.outerWidth and window.outerHeight.
-    await testWindowSizeSetting(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                                test.targetWidth, test.targetHeight, test.initWidth,
-                                test.initHeight, true, gMaxAvailWidth, gMaxAvailHeight,
-                                gPopupChromeUIWidth, gPopupChromeUIHeight);
-  }
-
-  await BrowserTestUtils.removeTab(tab);
-});
+WindowSettingTest.run([
+  {settingWidth: 1025, settingHeight: 1050, targetWidth: 1000, targetHeight: 1000, initWidth: 200, initHeight: 100},
+  {settingWidth: 9999, settingHeight: 9999, targetWidth: 1000, targetHeight: 1000, initWidth: 200, initHeight: 100},
+  {settingWidth: 999, settingHeight: 999, targetWidth: 1000, targetHeight: 1000, initWidth: 200, initHeight: 100}
+]);
--- a/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_windowSetting_mid.js
+++ b/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_windowSetting_mid.js
@@ -1,67 +1,11 @@
 /*
  * Bug 1330882 - A test case for setting window size through window.innerWidth/Height
  *   and window.outerWidth/Height when fingerprinting resistance is enabled. This
  *   test is for middle values.
  */
 
-const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
-
-const TEST_DOMAIN = "http://example.net/";
-const TEST_PATH = TEST_DOMAIN + "browser/browser/components/resistfingerprinting/test/browser/";
-
-let gMaxAvailWidth;
-let gMaxAvailHeight;
-
-// We need the chrome UI size of popup windows for testing outerWidth/Height.
-let gPopupChromeUIWidth;
-let gPopupChromeUIHeight;
-
-const TESTCASES = [
-  { settingWidth: 600, settingHeight: 600, targetWidth: 600, targetHeight: 600,
-    initWidth: 200, initHeight: 100  },
-  { settingWidth: 599, settingHeight: 599, targetWidth: 600, targetHeight: 600,
-    initWidth: 200, initHeight: 100  },
-  { settingWidth: 401, settingHeight: 501, targetWidth: 600, targetHeight: 600,
-    initWidth: 200, initHeight: 100  },
-];
-
-add_task(async function setup() {
-  await SpecialPowers.pushPrefEnv({"set":
-    [["privacy.resistFingerprinting", true]]
-  });
-
-  // Calculate the popup window's chrome UI size for tests of outerWidth/Height.
-  let popUpChromeUISize = await calcPopUpWindowChromeUISize();
-
-  gPopupChromeUIWidth = popUpChromeUISize.chromeWidth;
-  gPopupChromeUIHeight = popUpChromeUISize.chromeHeight;
-
-  // Calculate the maximum available size.
-  let maxAvailSize = await calcMaximumAvailSize(gPopupChromeUIWidth,
-                                                gPopupChromeUIHeight);
-
-  gMaxAvailWidth = maxAvailSize.maxAvailWidth;
-  gMaxAvailHeight = maxAvailSize.maxAvailHeight;
-});
-
-add_task(async function test_window_size_setting() {
-  // Open a tab to test.
-  let tab = await BrowserTestUtils.openNewForegroundTab(
-    gBrowser, TEST_PATH + "file_dummy.html");
-
-  for (let test of TESTCASES) {
-    // Test window.innerWidth and window.innerHeight.
-    await testWindowSizeSetting(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                                test.targetWidth, test.targetHeight, test.initWidth,
-                                test.initHeight, false, gMaxAvailWidth, gMaxAvailHeight,
-                                gPopupChromeUIWidth, gPopupChromeUIHeight);
-
-    // test window.outerWidth and window.outerHeight.
-    await testWindowSizeSetting(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                                test.targetWidth, test.targetHeight, test.initWidth,
-                                test.initHeight, true, gMaxAvailWidth, gMaxAvailHeight,
-                                gPopupChromeUIWidth, gPopupChromeUIHeight);
-  }
-
-  await BrowserTestUtils.removeTab(tab);
-});
+WindowSettingTest.run([
+  {settingWidth: 600, settingHeight: 600, targetWidth: 600, targetHeight: 600, initWidth: 200, initHeight: 100},
+  {settingWidth: 599, settingHeight: 599, targetWidth: 600, targetHeight: 600, initWidth: 200, initHeight: 100},
+  {settingWidth: 401, settingHeight: 501, targetWidth: 600, targetHeight: 600, initWidth: 200, initHeight: 100}
+]);
--- a/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_windowSetting_min.js
+++ b/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_windowSetting_min.js
@@ -1,65 +1,10 @@
 /*
  * Bug 1330882 - A test case for setting window size through window.innerWidth/Height
  *   and window.outerWidth/Height when fingerprinting resistance is enabled. This
  *   test is for minimum values.
  */
 
-const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
-
-const TEST_DOMAIN = "http://example.net/";
-const TEST_PATH = TEST_DOMAIN + "browser/browser/components/resistfingerprinting/test/browser/";
-
-let gMaxAvailWidth;
-let gMaxAvailHeight;
-
-// We need the chrome UI size of popup windows for testing outerWidth/Height.
-let gPopupChromeUIWidth;
-let gPopupChromeUIHeight;
-
-const TESTCASES = [
-  { settingWidth: 199, settingHeight: 99, targetWidth: 200, targetHeight: 100,
-    initWidth: 1000, initHeight: 1000  },
-  { settingWidth: 10, settingHeight: 10, targetWidth: 200, targetHeight: 100,
-    initWidth: 1000, initHeight: 1000  },
-];
-
-add_task(async function setup() {
-  await SpecialPowers.pushPrefEnv({"set":
-    [["privacy.resistFingerprinting", true]]
-  });
-
-  // Calculate the popup window's chrome UI size for tests of outerWidth/Height.
-  let popUpChromeUISize = await calcPopUpWindowChromeUISize();
-
-  gPopupChromeUIWidth = popUpChromeUISize.chromeWidth;
-  gPopupChromeUIHeight = popUpChromeUISize.chromeHeight;
-
-  // Calculate the maximum available size.
-  let maxAvailSize = await calcMaximumAvailSize(gPopupChromeUIWidth,
-                                                gPopupChromeUIHeight);
-
-  gMaxAvailWidth = maxAvailSize.maxAvailWidth;
-  gMaxAvailHeight = maxAvailSize.maxAvailHeight;
-});
-
-add_task(async function test_window_size_setting() {
-  // Open a tab to test.
-  let tab = await BrowserTestUtils.openNewForegroundTab(
-    gBrowser, TEST_PATH + "file_dummy.html");
-
-  for (let test of TESTCASES) {
-    // Test window.innerWidth and window.innerHeight.
-    await testWindowSizeSetting(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                                test.targetWidth, test.targetHeight, test.initWidth,
-                                test.initHeight, false, gMaxAvailWidth, gMaxAvailHeight,
-                                gPopupChromeUIWidth, gPopupChromeUIHeight);
-
-    // test window.outerWidth and window.outerHeight.
-    await testWindowSizeSetting(tab.linkedBrowser, test.settingWidth, test.settingHeight,
-                                test.targetWidth, test.targetHeight, test.initWidth,
-                                test.initHeight, true, gMaxAvailWidth, gMaxAvailHeight,
-                                gPopupChromeUIWidth, gPopupChromeUIHeight);
-  }
-
-  await BrowserTestUtils.removeTab(tab);
-});
+WindowSettingTest.run([
+  {settingWidth: 199, settingHeight: 99, targetWidth: 200, targetHeight: 100, initWidth: 1000, initHeight: 1000},
+  {settingWidth: 10, settingHeight: 10, targetWidth: 200, targetHeight: 100, initWidth: 1000, initHeight: 1000}
+]);
--- a/browser/components/resistfingerprinting/test/browser/head.js
+++ b/browser/components/resistfingerprinting/test/browser/head.js
@@ -223,8 +223,93 @@ async function testWindowSizeSetting(aBr
           win.innerHeight = input.settingHeight;
         }
       });
 
       win.close();
     }
   );
 }
+
+class RoundedWindowTest {
+  // testOuter is optional.  run() can be invoked with only 1 parameter.
+  static run(testCases, testOuter) {
+    // "this" is the calling class itself.
+    // e.g. when invoked by RoundedWindowTest.run(), "this" is "class RoundedWindowTest".
+    let test = new this(testCases);
+    add_task(async () => test.setup());
+    add_task(async () => {
+      if (testOuter == undefined) {
+        // If testOuter is not given, do tests for both inner and outer.
+        await test.doTests(false);
+        await test.doTests(true);
+      } else {
+        await test.doTests(testOuter);
+      }
+    });
+  }
+
+  get TEST_PATH() {
+    return "http://example.net/browser/browser/components/resistfingerprinting/test/browser/";
+  }
+
+  constructor(testCases) {
+    this.testCases = testCases;
+  }
+
+  async setup() {
+    await SpecialPowers.pushPrefEnv({"set":
+      [["privacy.resistFingerprinting", true]]
+    });
+
+    // Calculate the popup window's chrome UI size for tests of outerWidth/Height.
+    let popUpChromeUISize = await calcPopUpWindowChromeUISize();
+
+    this.popupChromeUIWidth = popUpChromeUISize.chromeWidth;
+    this.popupChromeUIHeight = popUpChromeUISize.chromeHeight;
+
+    // Calculate the maximum available size.
+    let maxAvailSize = await calcMaximumAvailSize(this.popupChromeUIWidth,
+                                                  this.popupChromeUIHeight);
+
+    this.maxAvailWidth = maxAvailSize.maxAvailWidth;
+    this.maxAvailHeight = maxAvailSize.maxAvailHeight;
+  }
+
+  async doTests(testOuter) {
+    // Open a tab to test.
+    this.tab = await BrowserTestUtils.openNewForegroundTab(
+      gBrowser, this.TEST_PATH + "file_dummy.html");
+
+    for (let test of this.testCases) {
+      await this.doTest(test, testOuter);
+    }
+
+    await BrowserTestUtils.removeTab(this.tab);
+  }
+
+  async doTest() {
+    throw new Error("RoundedWindowTest.doTest must be overridden.");
+  }
+}
+
+class WindowSettingTest extends RoundedWindowTest {
+  async doTest(test, testOuter) {
+    await testWindowSizeSetting(this.tab.linkedBrowser,
+                                test.settingWidth, test.settingHeight,
+                                test.targetWidth, test.targetHeight,
+                                test.initWidth, test.initHeight,
+                                testOuter,
+                                this.maxAvailWidth, this.maxAvailHeight,
+                                this.popupChromeUIWidth, this.popupChromeUIHeight);
+  }
+}
+
+class OpenTest extends RoundedWindowTest {
+  async doTest(test, testOuter) {
+    await testWindowOpen(this.tab.linkedBrowser,
+                         test.settingWidth, test.settingHeight,
+                         test.targetWidth, test.targetHeight,
+                         testOuter,
+                         this.maxAvailWidth, this.maxAvailHeight,
+                         this.popupChromeUIWidth, this.popupChromeUIHeight);
+  }
+}