OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """End to end tests for ChromeDriver.""" | 6 """End to end tests for ChromeDriver.""" |
7 | 7 |
8 import base64 | 8 import base64 |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 class ChromeDriverTest(ChromeDriverBaseTest): | 137 class ChromeDriverTest(ChromeDriverBaseTest): |
138 """End to end tests for ChromeDriver.""" | 138 """End to end tests for ChromeDriver.""" |
139 | 139 |
140 @staticmethod | 140 @staticmethod |
141 def GlobalSetUp(): | 141 def GlobalSetUp(): |
142 ChromeDriverTest._http_server = webserver.WebServer( | 142 ChromeDriverTest._http_server = webserver.WebServer( |
143 chrome_paths.GetTestData()) | 143 chrome_paths.GetTestData()) |
144 if _ANDROID_PACKAGE: | 144 if _ANDROID_PACKAGE: |
145 ChromeDriverTest._adb = android_commands.AndroidCommands() | 145 ChromeDriverTest._adb = android_commands.AndroidCommands() |
146 self._host_port = ChromeDriverTest._http_server._server.server_port | 146 forwarder.Forwarder.KillHost('Debug') |
147 forwarder.Forwarder.Map( | 147 ChromeDriverTest._forwarder = forwarder.Forwarder(ChromeDriverTest._adb, |
148 [(self._host_port, self._host_port)], ChromeDriverTest._adb) | 148 'Debug') |
| 149 host_port = ChromeDriverTest._http_server._server.server_port |
| 150 ChromeDriverTest._forwarder.Run( |
| 151 [(host_port, host_port)], valgrind_tools.BaseTool()) |
149 | 152 |
150 @staticmethod | 153 @staticmethod |
151 def GlobalTearDown(): | 154 def GlobalTearDown(): |
152 if _ANDROID_PACKAGE: | 155 if _ANDROID_PACKAGE: |
153 forwarder.Forwarder.UnmapAllDevicePorts(ChromeDriverTest._adb) | 156 forwarder.Forwarder.KillDevice(ChromeDriverTest._adb, |
| 157 valgrind_tools.BaseTool()) |
| 158 ChromeDriverTest._forwarder.Close() |
154 ChromeDriverTest._http_server.Shutdown() | 159 ChromeDriverTest._http_server.Shutdown() |
155 | 160 |
156 @staticmethod | 161 @staticmethod |
157 def GetHttpUrlForFile(file_path): | 162 def GetHttpUrlForFile(file_path): |
158 return ChromeDriverTest._http_server.GetUrl() + file_path | 163 return ChromeDriverTest._http_server.GetUrl() + file_path |
159 | 164 |
160 def setUp(self): | 165 def setUp(self): |
161 self._driver = self.CreateDriver() | 166 self._driver = self.CreateDriver() |
162 | 167 |
163 def testStartStop(self): | 168 def testStartStop(self): |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 negative_filter = _GetDesktopNegativeFilter(options.chrome_version) | 740 negative_filter = _GetDesktopNegativeFilter(options.chrome_version) |
736 options.filter = '*-' + ':__main__.'.join([''] + negative_filter) | 741 options.filter = '*-' + ':__main__.'.join([''] + negative_filter) |
737 | 742 |
738 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( | 743 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( |
739 sys.modules[__name__]) | 744 sys.modules[__name__]) |
740 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) | 745 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) |
741 ChromeDriverTest.GlobalSetUp() | 746 ChromeDriverTest.GlobalSetUp() |
742 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests) | 747 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests) |
743 ChromeDriverTest.GlobalTearDown() | 748 ChromeDriverTest.GlobalTearDown() |
744 sys.exit(len(result.failures) + len(result.errors)) | 749 sys.exit(len(result.failures) + len(result.errors)) |
OLD | NEW |