Diff
Modified: trunk/Tools/ChangeLog (139094 => 139095)
--- trunk/Tools/ChangeLog 2013-01-08 20:21:36 UTC (rev 139094)
+++ trunk/Tools/ChangeLog 2013-01-08 20:23:47 UTC (rev 139095)
@@ -1,3 +1,38 @@
+2013-01-08 Zan Dobersek <[email protected]>
+
+ [EFL][GTK] Make the PulseAudioSanitizer an object on the EflPort, GtkPort
+ https://bugs.webkit.org/show_bug.cgi?id=106354
+
+ Reviewed by Eric Seidel.
+
+ Put the PulseAudioSanitizer object on the EflPort and GtkPort interfaces
+ instead of those two inheriting from it. Also add a mock object of the
+ sanitizer that's used in unit tests.
+
+ * Scripts/webkitpy/layout_tests/port/efl.py:
+ (EflPort):
+ (EflPort.__init__):
+ (EflPort.setup_test_run):
+ (EflPort.clean_up_test_run):
+ * Scripts/webkitpy/layout_tests/port/efl_unittest.py: Also correct the
+ importing order.
+ (EflPortTest.make_port): Put a mock PulseAudioSanitizer on the instance.
+ * Scripts/webkitpy/layout_tests/port/gtk.py:
+ (GtkPort):
+ (GtkPort.__init__):
+ (GtkPort.setup_test_run):
+ (GtkPort.clean_up_test_run):
+ * Scripts/webkitpy/layout_tests/port/gtk_unittest.py: Also correct the
+ importing order.
+ (GtkPortTest.make_port): Put a mock PulseAudioSanitizer on the instance.
+ * Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer.py:
+ (PulseAudioSanitizer.unload_pulseaudio_module): Stylize the method as public.
+ (PulseAudioSanitizer.restore_pulseaudio_module): Ditto.
+ * Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer_mock.py: Added.
+ (PulseAudioSanitizerMock): A simple mock interface for PulseAudioSanitizer.
+ (PulseAudioSanitizerMock.unload_pulseaudio_module):
+ (PulseAudioSanitizerMock.restore_pulseaudio_module):
+
2013-01-08 Jochen Eisinger <[email protected]>
[chromium] move dumpFrameLoadCallbacks and friends to the TestRunner library
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/efl.py (139094 => 139095)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/efl.py 2013-01-08 20:21:36 UTC (rev 139094)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/efl.py 2013-01-08 20:23:47 UTC (rev 139095)
@@ -34,7 +34,8 @@
from webkitpy.layout_tests.port.pulseaudio_sanitizer import PulseAudioSanitizer
from webkitpy.layout_tests.port.xvfbdriver import XvfbDriver
-class EflPort(Port, PulseAudioSanitizer):
+
+class EflPort(Port):
port_name = 'efl'
def __init__(self, *args, **kwargs):
@@ -45,11 +46,13 @@
self.set_option_default('wrapper', self._jhbuild_wrapper_path)
self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix')
+ self._pulseaudio_sanitizer = PulseAudioSanitizer()
+
def _port_flag_for_scripts(self):
return "--efl"
def setup_test_run(self):
- self._unload_pulseaudio_module()
+ self._pulseaudio_sanitizer.unload_pulseaudio_module()
def setup_environ_for_server(self, server_name=None):
env = super(EflPort, self).setup_environ_for_server(server_name)
@@ -73,7 +76,7 @@
def clean_up_test_run(self):
super(EflPort, self).clean_up_test_run()
- self._restore_pulseaudio_module()
+ self._pulseaudio_sanitizer.restore_pulseaudio_module()
def _generate_all_test_configurations(self):
return [TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES]
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/efl_unittest.py (139094 => 139095)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/efl_unittest.py 2013-01-08 20:21:36 UTC (rev 139094)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/efl_unittest.py 2013-01-08 20:23:47 UTC (rev 139095)
@@ -26,10 +26,11 @@
import unittest
+from webkitpy.common.system.executive_mock import MockExecutive
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.layout_tests.port.efl import EflPort
+from webkitpy.layout_tests.port.pulseaudio_sanitizer_mock import PulseAudioSanitizerMock
from webkitpy.layout_tests.port import port_testcase
-from webkitpy.common.system.executive_mock import MockExecutive
class EflPortTest(port_testcase.PortTestCase):
@@ -39,8 +40,7 @@
# Additionally mocks out the PulseAudioSanitizer methods.
def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
port = super(EflPortTest, self).make_port(host, port_name, options, os_name, os_version, **kwargs)
- port._unload_pulseaudio_module = lambda: None
- port._restore_pulseaudio_module = lambda: None
+ port._pulseaudio_sanitizer = PulseAudioSanitizerMock()
return port
def test_show_results_html_file(self):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py (139094 => 139095)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py 2013-01-08 20:21:36 UTC (rev 139094)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py 2013-01-08 20:23:47 UTC (rev 139095)
@@ -35,9 +35,13 @@
from webkitpy.layout_tests.port.xvfbdriver import XvfbDriver
-class GtkPort(Port, PulseAudioSanitizer):
+class GtkPort(Port):
port_name = "gtk"
+ def __init__(self, *args, **kwargs):
+ super(GtkPort, self).__init__(*args, **kwargs)
+ self._pulseaudio_sanitizer = PulseAudioSanitizer()
+
def warn_if_bug_missing_in_test_expectations(self):
return True
@@ -53,11 +57,11 @@
return 6 * 1000
def setup_test_run(self):
- self._unload_pulseaudio_module()
+ self._pulseaudio_sanitizer.unload_pulseaudio_module()
def clean_up_test_run(self):
super(GtkPort, self).clean_up_test_run()
- self._restore_pulseaudio_module()
+ self._pulseaudio_sanitizer.restore_pulseaudio_module()
def setup_environ_for_server(self, server_name=None):
environment = super(GtkPort, self).setup_environ_for_server(server_name)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py (139094 => 139095)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py 2013-01-08 20:21:36 UTC (rev 139094)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py 2013-01-08 20:23:47 UTC (rev 139095)
@@ -30,12 +30,13 @@
import sys
import os
+from webkitpy.common.system.executive_mock import MockExecutive
+from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.layout_tests.port.gtk import GtkPort
+from webkitpy.layout_tests.port.pulseaudio_sanitizer_mock import PulseAudioSanitizerMock
from webkitpy.layout_tests.port import port_testcase
-from webkitpy.common.system.executive_mock import MockExecutive
from webkitpy.thirdparty.mock import Mock
-from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.tool.mocktool import MockOptions
@@ -46,8 +47,7 @@
# Additionally mocks out the PulseAudioSanitizer methods.
def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
port = super(GtkPortTest, self).make_port(host, port_name, options, os_name, os_version, **kwargs)
- port._unload_pulseaudio_module = lambda: None
- port._restore_pulseaudio_module = lambda: None
+ port._pulseaudio_sanitizer = PulseAudioSanitizerMock()
return port
def test_expectations_files(self):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer.py (139094 => 139095)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer.py 2013-01-08 20:21:36 UTC (rev 139094)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer.py 2013-01-08 20:23:47 UTC (rev 139095)
@@ -37,7 +37,7 @@
# Shared by GTK and EFL for pulseaudio sanitizing before running tests.
class PulseAudioSanitizer:
- def _unload_pulseaudio_module(self):
+ def unload_pulseaudio_module(self):
# Unload pulseaudio's module-stream-restore, since it remembers
# volume settings from different runs, and could affect
# multimedia tests results
@@ -71,7 +71,7 @@
_log.debug('Unable to parse module index. Please check if your pulseaudio-utils version is too old.')
return
- def _restore_pulseaudio_module(self):
+ def restore_pulseaudio_module(self):
# If pulseaudio's module-stream-restore was previously unloaded,
# restore it back. We shouldn't need extra checks here, since an
# index != -1 here means we successfully unloaded it previously.
Added: trunk/Tools/Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer_mock.py (0 => 139095)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer_mock.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer_mock.py 2013-01-08 20:23:47 UTC (rev 139095)
@@ -0,0 +1,35 @@
+# Copyrigth (C) 2013 Zan Dobersek <[email protected]>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the Google name nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+class PulseAudioSanitizerMock:
+ def unload_pulseaudio_module(self):
+ pass
+
+ def restore_pulseaudio_module(self):
+ pass