[webkitpy] Make the Xvfb screen depth overridable
[WebKit-https.git] / Tools / Scripts / webkitpy / port / xvfbdriver_unittest.py
index 3ab5d46..e1cfa79 100644 (file)
@@ -51,6 +51,7 @@ class XvfbDriverTest(unittest.TestCase):
 
         driver = XvfbDriver(port, worker_number=worker_number, pixel_tests=True)
         driver._startup_delay_secs = 0
+        driver._xvfb_screen_depth = lambda: '24'
         return driver
 
     def cleanup_driver(self, driver):
@@ -66,24 +67,24 @@ class XvfbDriverTest(unittest.TestCase):
 
     def test_start_no_pixel_tests(self):
         driver = self.make_driver()
-        expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
+        expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
         self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0")
         self.cleanup_driver(driver)
 
     def test_start_pixel_tests(self):
         driver = self.make_driver()
-        expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
+        expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
         self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
         self.cleanup_driver(driver)
 
     def test_start_arbitrary_worker_number(self):
         driver = self.make_driver(worker_number=17)
-        expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
+        expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
         self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
         self.cleanup_driver(driver)
 
     def test_next_free_display(self):
-        output = "Xorg            /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none\nXvfb            Xvfb :1 -screen 0 800x600x8 -nolisten tcp"
+        output = "Xorg            /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none\nXvfb            Xvfb :1 -screen 0 800x600x24 -nolisten tcp"
         executive = MockExecutive2(output)
         driver = self.make_driver(executive=executive)
         self.assertEqual(driver._next_free_display(), 2)
@@ -93,12 +94,12 @@ class XvfbDriverTest(unittest.TestCase):
         driver = self.make_driver(executive=executive)
         self.assertEqual(driver._next_free_display(), 1)
         self.cleanup_driver(driver)
-        output = "Xvfb            Xvfb :0 -screen 0 800x600x8 -nolisten tcp"
+        output = "Xvfb            Xvfb :0 -screen 0 800x600x24 -nolisten tcp"
         executive = MockExecutive2(output)
         driver = self.make_driver(executive=executive)
         self.assertEqual(driver._next_free_display(), 1)
         self.cleanup_driver(driver)
-        output = "Xvfb            Xvfb :1 -screen 0 800x600x8 -nolisten tcp\nXvfb            Xvfb :0 -screen 0 800x600x8 -nolisten tcp\nXvfb            Xvfb :3 -screen 0 800x600x8 -nolisten tcp"
+        output = "Xvfb            Xvfb :1 -screen 0 800x600x24 -nolisten tcp\nXvfb            Xvfb :0 -screen 0 800x600x24 -nolisten tcp\nXvfb            Xvfb :3 -screen 0 800x600x24 -nolisten tcp"
         executive = MockExecutive2(output)
         driver = self.make_driver(executive=executive)
         self.assertEqual(driver._next_free_display(), 2)
@@ -107,12 +108,12 @@ class XvfbDriverTest(unittest.TestCase):
     def test_start_next_worker(self):
         driver = self.make_driver()
         driver._next_free_display = lambda: 0
-        expected_logs = "MOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
+        expected_logs = "MOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
         self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
         self.cleanup_driver(driver)
         driver = self.make_driver()
         driver._next_free_display = lambda: 3
-        expected_logs = "MOCK popen: ['Xvfb', ':3', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
+        expected_logs = "MOCK popen: ['Xvfb', ':3', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
         self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":3", pixel_tests=True)
         self.cleanup_driver(driver)