Changeset 139095 in webkit


Ignore:
Timestamp:
Jan 8, 2013 12:23:47 PM (11 years ago)
Author:
zandobersek@gmail.com
Message:

[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):

Location:
trunk/Tools
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r139090 r139095  
     12013-01-08  Zan Dobersek  <zandobersek@gmail.com>
     2
     3        [EFL][GTK] Make the PulseAudioSanitizer an object on the EflPort, GtkPort
     4        https://bugs.webkit.org/show_bug.cgi?id=106354
     5
     6        Reviewed by Eric Seidel.
     7
     8        Put the PulseAudioSanitizer object on the EflPort and GtkPort interfaces
     9        instead of those two inheriting from it. Also add a mock object of the
     10        sanitizer that's used in unit tests.
     11
     12        * Scripts/webkitpy/layout_tests/port/efl.py:
     13        (EflPort):
     14        (EflPort.__init__):
     15        (EflPort.setup_test_run):
     16        (EflPort.clean_up_test_run):
     17        * Scripts/webkitpy/layout_tests/port/efl_unittest.py: Also correct the
     18        importing order.
     19        (EflPortTest.make_port): Put a mock PulseAudioSanitizer on the instance.
     20        * Scripts/webkitpy/layout_tests/port/gtk.py:
     21        (GtkPort):
     22        (GtkPort.__init__):
     23        (GtkPort.setup_test_run):
     24        (GtkPort.clean_up_test_run):
     25        * Scripts/webkitpy/layout_tests/port/gtk_unittest.py: Also correct the
     26        importing order.
     27        (GtkPortTest.make_port): Put a mock PulseAudioSanitizer on the instance.
     28        * Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer.py:
     29        (PulseAudioSanitizer.unload_pulseaudio_module): Stylize the method as public.
     30        (PulseAudioSanitizer.restore_pulseaudio_module): Ditto.
     31        * Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer_mock.py: Added.
     32        (PulseAudioSanitizerMock): A simple mock interface for PulseAudioSanitizer.
     33        (PulseAudioSanitizerMock.unload_pulseaudio_module):
     34        (PulseAudioSanitizerMock.restore_pulseaudio_module):
     35
    1362013-01-08  Jochen Eisinger  <jochen@chromium.org>
    237
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/efl.py

    r133036 r139095  
    3535from webkitpy.layout_tests.port.xvfbdriver import XvfbDriver
    3636
    37 class EflPort(Port, PulseAudioSanitizer):
     37
     38class EflPort(Port):
    3839    port_name = 'efl'
    3940
     
    4647        self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix')
    4748
     49        self._pulseaudio_sanitizer = PulseAudioSanitizer()
     50
    4851    def _port_flag_for_scripts(self):
    4952        return "--efl"
    5053
    5154    def setup_test_run(self):
    52         self._unload_pulseaudio_module()
     55        self._pulseaudio_sanitizer.unload_pulseaudio_module()
    5356
    5457    def setup_environ_for_server(self, server_name=None):
     
    7477    def clean_up_test_run(self):
    7578        super(EflPort, self).clean_up_test_run()
    76         self._restore_pulseaudio_module()
     79        self._pulseaudio_sanitizer.restore_pulseaudio_module()
    7780
    7881    def _generate_all_test_configurations(self):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/efl_unittest.py

    r139084 r139095  
    2727import unittest
    2828
     29from webkitpy.common.system.executive_mock import MockExecutive
    2930from webkitpy.common.system.outputcapture import OutputCapture
    3031from webkitpy.layout_tests.port.efl import EflPort
     32from webkitpy.layout_tests.port.pulseaudio_sanitizer_mock import PulseAudioSanitizerMock
    3133from webkitpy.layout_tests.port import port_testcase
    32 from webkitpy.common.system.executive_mock import MockExecutive
    3334
    3435
     
    4041    def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
    4142        port = super(EflPortTest, self).make_port(host, port_name, options, os_name, os_version, **kwargs)
    42         port._unload_pulseaudio_module = lambda: None
    43         port._restore_pulseaudio_module = lambda: None
     43        port._pulseaudio_sanitizer = PulseAudioSanitizerMock()
    4444        return port
    4545
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py

    r139088 r139095  
    3636
    3737
    38 class GtkPort(Port, PulseAudioSanitizer):
     38class GtkPort(Port):
    3939    port_name = "gtk"
     40
     41    def __init__(self, *args, **kwargs):
     42        super(GtkPort, self).__init__(*args, **kwargs)
     43        self._pulseaudio_sanitizer = PulseAudioSanitizer()
    4044
    4145    def warn_if_bug_missing_in_test_expectations(self):
     
    5458
    5559    def setup_test_run(self):
    56         self._unload_pulseaudio_module()
     60        self._pulseaudio_sanitizer.unload_pulseaudio_module()
    5761
    5862    def clean_up_test_run(self):
    5963        super(GtkPort, self).clean_up_test_run()
    60         self._restore_pulseaudio_module()
     64        self._pulseaudio_sanitizer.restore_pulseaudio_module()
    6165
    6266    def setup_environ_for_server(self, server_name=None):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py

    r139088 r139095  
    3131import os
    3232
     33from webkitpy.common.system.executive_mock import MockExecutive
     34from webkitpy.common.system.filesystem_mock import MockFileSystem
    3335from webkitpy.common.system.outputcapture import OutputCapture
    3436from webkitpy.layout_tests.port.gtk import GtkPort
     37from webkitpy.layout_tests.port.pulseaudio_sanitizer_mock import PulseAudioSanitizerMock
    3538from webkitpy.layout_tests.port import port_testcase
    36 from webkitpy.common.system.executive_mock import MockExecutive
    3739from webkitpy.thirdparty.mock import Mock
    38 from webkitpy.common.system.filesystem_mock import MockFileSystem
    3940from webkitpy.tool.mocktool import MockOptions
    4041
     
    4748    def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
    4849        port = super(GtkPortTest, self).make_port(host, port_name, options, os_name, os_version, **kwargs)
    49         port._unload_pulseaudio_module = lambda: None
    50         port._restore_pulseaudio_module = lambda: None
     50        port._pulseaudio_sanitizer = PulseAudioSanitizerMock()
    5151        return port
    5252
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/pulseaudio_sanitizer.py

    r115478 r139095  
    3838# Shared by GTK and EFL for pulseaudio sanitizing before running tests.
    3939class PulseAudioSanitizer:
    40     def _unload_pulseaudio_module(self):
     40    def unload_pulseaudio_module(self):
    4141        # Unload pulseaudio's module-stream-restore, since it remembers
    4242        # volume settings from different runs, and could affect
     
    7272                return
    7373
    74     def _restore_pulseaudio_module(self):
     74    def restore_pulseaudio_module(self):
    7575        # If pulseaudio's module-stream-restore was previously unloaded,
    7676        # restore it back. We shouldn't need extra checks here, since an
Note: See TracChangeset for help on using the changeset viewer.