Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: chrome/test/chromedriver/run_py_tests.py

Issue 20824008: Reland r212020: Move Python setup/tear down logic into Forwarder ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Close unused FDs Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 forwarder.Forwarder.KillHost('Debug') 146 self._host_port = ChromeDriverTest._http_server._server.server_port
147 ChromeDriverTest._forwarder = forwarder.Forwarder(ChromeDriverTest._adb, 147 forwarder.Forwarder.Map(
148 'Debug') 148 [(self._host_port, self._host_port)], ChromeDriverTest._adb)
149 host_port = ChromeDriverTest._http_server._server.server_port
150 ChromeDriverTest._forwarder.Run(
151 [(host_port, host_port)], valgrind_tools.BaseTool())
152 149
153 @staticmethod 150 @staticmethod
154 def GlobalTearDown(): 151 def GlobalTearDown():
155 if _ANDROID_PACKAGE: 152 if _ANDROID_PACKAGE:
156 forwarder.Forwarder.KillDevice(ChromeDriverTest._adb, 153 forwarder.Forwarder.UnmapAllDevicePorts(ChromeDriverTest._adb)
157 valgrind_tools.BaseTool())
158 ChromeDriverTest._forwarder.Close()
159 ChromeDriverTest._http_server.Shutdown() 154 ChromeDriverTest._http_server.Shutdown()
160 155
161 @staticmethod 156 @staticmethod
162 def GetHttpUrlForFile(file_path): 157 def GetHttpUrlForFile(file_path):
163 return ChromeDriverTest._http_server.GetUrl() + file_path 158 return ChromeDriverTest._http_server.GetUrl() + file_path
164 159
165 def setUp(self): 160 def setUp(self):
166 self._driver = self.CreateDriver() 161 self._driver = self.CreateDriver()
167 162
168 def testStartStop(self): 163 def testStartStop(self):
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 negative_filter = _GetDesktopNegativeFilter(options.chrome_version) 741 negative_filter = _GetDesktopNegativeFilter(options.chrome_version)
747 options.filter = '*-' + ':__main__.'.join([''] + negative_filter) 742 options.filter = '*-' + ':__main__.'.join([''] + negative_filter)
748 743
749 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( 744 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule(
750 sys.modules[__name__]) 745 sys.modules[__name__])
751 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) 746 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter)
752 ChromeDriverTest.GlobalSetUp() 747 ChromeDriverTest.GlobalSetUp()
753 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests) 748 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests)
754 ChromeDriverTest.GlobalTearDown() 749 ChromeDriverTest.GlobalTearDown()
755 sys.exit(len(result.failures) + len(result.errors)) 750 sys.exit(len(result.failures) + len(result.errors))
OLDNEW
« no previous file with comments | « build/android/pylib/instrumentation/test_runner.py ('k') | chrome/test/chromedriver/test_environment.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698