def get(port_name=None, options=None): """Returns an object implementing the Port interface. If port_name is None, this routine attempts to guess at the most appropriate port on this platform.""" port_to_use = port_name if port_to_use is None: if sys.platform == 'win32': port_to_use = 'chromium-win' elif sys.platform == 'linux2': port_to_use = 'chromium-linux' elif sys.platform == 'darwin': port_to_use = 'chromium-mac' if port_to_use == 'test': import test return test.TestPort(port_name, options) elif port_to_use.startswith('mac'): import mac return mac.MacPort(port_name, options) elif port_to_use.startswith('chromium-mac'): import chromium_mac return chromium_mac.ChromiumMacPort(port_name, options) elif port_to_use.startswith('chromium-linux'): import chromium_linux return chromium_linux.ChromiumLinuxPort(port_name, options) elif port_to_use.startswith('chromium-win'): import chromium_win return chromium_win.ChromiumWinPort(port_name, options) raise NotImplementedError('unsupported port: %s' % port_to_use)
def get(port_name=None, options=None): """Returns an object implementing the Port interface. If port_name is None, this routine attempts to guess at the most appropriate port on this platform.""" port_to_use = port_name if port_to_use is None: if sys.platform == 'win32' or sys.platform == 'cygwin': if options and hasattr(options, 'chromium') and options.chromium: port_to_use = 'chromium-win' else: port_to_use = 'win' elif sys.platform == 'linux2': port_to_use = 'chromium-linux' elif sys.platform == 'darwin': if options and hasattr(options, 'chromium') and options.chromium: port_to_use = 'chromium-mac' else: port_to_use = 'mac' if port_to_use is None: raise NotImplementedError('unknown port; sys.platform = "%s"' % sys.platform) if port_to_use == 'test': import test return test.TestPort(port_name, options) elif port_to_use.startswith('dryrun'): import dryrun return dryrun.DryRunPort(port_name, options) elif port_to_use.startswith('mac'): import mac return mac.MacPort(port_name, options) elif port_to_use.startswith('win'): import win return win.WinPort(port_name, options) elif port_to_use.startswith('gtk'): import gtk return gtk.GtkPort(port_name, options) elif port_to_use.startswith('qt'): import qt return qt.QtPort(port_name, options) elif port_to_use.startswith('chromium-mac'): import chromium_mac return chromium_mac.ChromiumMacPort(port_name, options) elif port_to_use.startswith('chromium-linux'): import chromium_linux return chromium_linux.ChromiumLinuxPort(port_name, options) elif port_to_use.startswith('chromium-win'): import chromium_win return chromium_win.ChromiumWinPort(port_name, options) elif port_to_use.startswith('google-chrome'): import google_chrome return google_chrome.GetGoogleChromePort(port_name, options) raise NotImplementedError('unsupported port: %s' % port_to_use)
def test_path_to_image_diff(self): class MockOptions: def __init__(self): self.use_drt = True port = chromium_linux.ChromiumLinuxPort('test-port', options=MockOptions()) self.assertTrue( port._path_to_image_diff().endswith('/out/Release/ImageDiff')) port = chromium_mac.ChromiumMacPort('test-port', options=MockOptions()) self.assertTrue(port._path_to_image_diff().endswith( '/xcodebuild/Release/ImageDiff'))
def test_skipped_layout_tests(self): class MockOptions: def __init__(self): self.use_drt = True port = chromium_linux.ChromiumLinuxPort('test-port', options=MockOptions()) fake_test = os.path.join(port.layout_tests_dir(), "fast/js/not-good.js") port.test_expectations = lambda: """BUG_TEST SKIP : fast/js/not-good.js = TEXT DEFER LINUX WIN : fast/js/very-good.js = TIMEOUT PASS""" port.test_expectations_overrides = lambda: '' skipped_tests = port.skipped_layout_tests(extra_test_files=[ fake_test, ]) self.assertTrue("fast/js/not-good.js" in skipped_tests)