| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 import unittest2 as unittest | 29 import unittest2 as unittest |
| 30 | 30 |
| 31 from webkitpy.tool.mocktool import MockOptions | 31 from webkitpy.tool.mocktool import MockOptions |
| 32 from webkitpy.common.system.systemhost_mock import MockSystemHost | 32 from webkitpy.common.system.systemhost_mock import MockSystemHost |
| 33 | 33 |
| 34 from webkitpy.layout_tests.port import chromium_android | 34 from webkitpy.layout_tests.port import chromium_android |
| 35 from webkitpy.layout_tests.port import chromium_linux | 35 from webkitpy.layout_tests.port import chromium_linux |
| 36 from webkitpy.layout_tests.port import chromium_mac | 36 from webkitpy.layout_tests.port import chromium_mac |
| 37 from webkitpy.layout_tests.port import chromium_win | 37 from webkitpy.layout_tests.port import win |
| 38 from webkitpy.layout_tests.port import factory | 38 from webkitpy.layout_tests.port import factory |
| 39 from webkitpy.layout_tests.port import test | 39 from webkitpy.layout_tests.port import test |
| 40 | 40 |
| 41 | 41 |
| 42 class FactoryTest(unittest.TestCase): | 42 class FactoryTest(unittest.TestCase): |
| 43 """Test that the factory creates the proper port object for given combinatio
n of port_name, host.platform, and options.""" | 43 """Test that the factory creates the proper port object for given combinatio
n of port_name, host.platform, and options.""" |
| 44 # FIXME: The ports themselves should expose what options they require, | 44 # FIXME: The ports themselves should expose what options they require, |
| 45 # instead of passing generic "options". | 45 # instead of passing generic "options". |
| 46 | 46 |
| 47 def setUp(self): | 47 def setUp(self): |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 def test_chromium_linux(self): | 61 def test_chromium_linux(self): |
| 62 self.assert_port(port_name='chromium-linux', cls=chromium_linux.Chromium
LinuxPort) | 62 self.assert_port(port_name='chromium-linux', cls=chromium_linux.Chromium
LinuxPort) |
| 63 self.assert_port(port_name='chromium', os_name='linux', os_version='luci
d', | 63 self.assert_port(port_name='chromium', os_name='linux', os_version='luci
d', |
| 64 cls=chromium_linux.ChromiumLinuxPort) | 64 cls=chromium_linux.ChromiumLinuxPort) |
| 65 | 65 |
| 66 def test_chromium_android(self): | 66 def test_chromium_android(self): |
| 67 self.assert_port(port_name='chromium-android', cls=chromium_android.Chro
miumAndroidPort) | 67 self.assert_port(port_name='chromium-android', cls=chromium_android.Chro
miumAndroidPort) |
| 68 # NOTE: We can't check for port_name=chromium here, as this will append
the host's | 68 # NOTE: We can't check for port_name=chromium here, as this will append
the host's |
| 69 # operating system, whereas host!=target for Android. | 69 # operating system, whereas host!=target for Android. |
| 70 | 70 |
| 71 def test_chromium_win(self): | 71 def test_win(self): |
| 72 self.assert_port(port_name='chromium-win-xp', cls=chromium_win.ChromiumW
inPort) | 72 self.assert_port(port_name='win-xp', cls=win.WinPort) |
| 73 self.assert_port(port_name='chromium-win', os_name='win', os_version='xp
', | 73 self.assert_port(port_name='win', os_name='win', os_version='xp', |
| 74 cls=chromium_win.ChromiumWinPort) | 74 cls=win.WinPort) |
| 75 self.assert_port(port_name='chromium', os_name='win', os_version='xp', | 75 self.assert_port(port_name='chromium', os_name='win', os_version='xp', |
| 76 cls=chromium_win.ChromiumWinPort) | 76 cls=win.WinPort) |
| 77 | 77 |
| 78 def test_unknown_specified(self): | 78 def test_unknown_specified(self): |
| 79 self.assertRaises(NotImplementedError, factory.PortFactory(MockSystemHos
t()).get, port_name='unknown') | 79 self.assertRaises(NotImplementedError, factory.PortFactory(MockSystemHos
t()).get, port_name='unknown') |
| 80 | 80 |
| 81 def test_unknown_default(self): | 81 def test_unknown_default(self): |
| 82 self.assertRaises(NotImplementedError, factory.PortFactory(MockSystemHos
t(os_name='vms')).get) | 82 self.assertRaises(NotImplementedError, factory.PortFactory(MockSystemHos
t(os_name='vms')).get) |
| 83 | 83 |
| 84 def test_get_from_builder_name(self): | 84 def test_get_from_builder_name(self): |
| 85 self.assertEqual(factory.PortFactory(MockSystemHost()).get_from_builder_
name('WebKit Mac10.7').name(), | 85 self.assertEqual(factory.PortFactory(MockSystemHost()).get_from_builder_
name('WebKit Mac10.7').name(), |
| 86 'chromium-mac-lion') | 86 'chromium-mac-lion') |
| OLD | NEW |