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

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

Issue 14130017: [chromedriver] Add option to relaunch the test harness after each java test for debugging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """TestEnvironment classes. 5 """TestEnvironment classes.
6 6
7 These classes abstract away the various setups needed to run the WebDriver java 7 These classes abstract away the various setups needed to run the WebDriver java
8 tests in various environments. 8 tests in various environments.
9 """ 9 """
10 10
(...skipping 24 matching lines...) Expand all
35 """Manages the environment java tests require to run.""" 35 """Manages the environment java tests require to run."""
36 36
37 def __init__(self, chrome_version='HEAD'): 37 def __init__(self, chrome_version='HEAD'):
38 """Initializes a desktop test environment. 38 """Initializes a desktop test environment.
39 39
40 Args: 40 Args:
41 chrome_version: Optionally a chrome version to run the tests against. 41 chrome_version: Optionally a chrome version to run the tests against.
42 """ 42 """
43 self._chrome_version = chrome_version 43 self._chrome_version = chrome_version
44 44
45 def GetOS(self):
46 """Name of the OS."""
47 raise NotImplementedError
48
45 def GlobalSetUp(self): 49 def GlobalSetUp(self):
46 """Sets up the global test environment state.""" 50 """Sets up the global test environment state."""
47 pass 51 pass
48 52
49 def GlobalTearDown(self): 53 def GlobalTearDown(self):
50 """Tears down the global test environment state.""" 54 """Tears down the global test environment state."""
51 pass 55 pass
52 56
53 def GetPassedJavaTestFilter(self): 57 def GetPassedJavaTestFilter(self):
54 """Returns the test filter for running all passing tests. 58 """Returns the test filter for running all passing tests.
55 59
56 Returns: 60 Returns:
57 Filter string, in Google Test (C++) format. 61 Filter string, in Google Test (C++) format.
58 """ 62 """
59 raise NotImplementedError 63 return _EXPECTATIONS['GetPassedJavaTestFilter'](
64 'android', self._chrome_version)
65
66 def GetPassedJavaTests(self):
frankf 2013/04/16 23:21:35 doc
67 with open(os.path.join(_THIS_DIR, 'java_tests.txt'), 'r') as f:
68 return _EXPECTATIONS['ApplyJavaTestFilter'](
69 'android', self._chrome_version,
70 [t.strip('\n') for t in f.readlines()])
60 71
61 72
62 class DesktopTestEnvironment(BaseTestEnvironment): 73 class DesktopTestEnvironment(BaseTestEnvironment):
63 """Manages the environment java tests require to run on Desktop.""" 74 """Manages the environment java tests require to run on Desktop."""
64 75
65 #override 76 #override
66 def GetPassedJavaTestFilter(self): 77 def GetOS(self):
67 return _EXPECTATIONS['GetPassedJavaTestFilter']( 78 return util.GetPlatformName()
68 util.GetPlatformName(), self._chrome_version)
69 79
70 80
71 class AndroidTestEnvironment(DesktopTestEnvironment): 81 class AndroidTestEnvironment(DesktopTestEnvironment):
72 """Manages the environment java tests require to run on Android.""" 82 """Manages the environment java tests require to run on Android."""
73 83
74 def __init__(self, chrome_version='HEAD'): 84 def __init__(self, chrome_version='HEAD'):
75 super(AndroidTestEnvironment, self).__init__(chrome_version) 85 super(AndroidTestEnvironment, self).__init__(chrome_version)
76 self._adb = None 86 self._adb = None
77 self._forwarder = None 87 self._forwarder = None
78 88
79 #override 89 #override
80 def GlobalSetUp(self): 90 def GlobalSetUp(self):
81 os.putenv('TEST_HTTP_PORT', str(ANDROID_TEST_HTTP_PORT)) 91 os.putenv('TEST_HTTP_PORT', str(ANDROID_TEST_HTTP_PORT))
82 os.putenv('TEST_HTTPS_PORT', str(ANDROID_TEST_HTTPS_PORT)) 92 os.putenv('TEST_HTTPS_PORT', str(ANDROID_TEST_HTTPS_PORT))
83 self._adb = android_commands.AndroidCommands() 93 self._adb = android_commands.AndroidCommands()
84 self._forwarder = forwarder.Forwarder(self._adb, 'Debug') 94 self._forwarder = forwarder.Forwarder(self._adb, 'Debug')
85 self._forwarder.Run( 95 self._forwarder.Run(
86 [(ANDROID_TEST_HTTP_PORT, ANDROID_TEST_HTTP_PORT), 96 [(ANDROID_TEST_HTTP_PORT, ANDROID_TEST_HTTP_PORT),
87 (ANDROID_TEST_HTTPS_PORT, ANDROID_TEST_HTTPS_PORT)], 97 (ANDROID_TEST_HTTPS_PORT, ANDROID_TEST_HTTPS_PORT)],
88 valgrind_tools.BaseTool(), '127.0.0.1') 98 valgrind_tools.BaseTool(), '127.0.0.1')
89 99
90 #override 100 #override
91 def GlobalTearDown(self): 101 def GlobalTearDown(self):
92 if self._adb is not None: 102 if self._adb is not None:
93 forwarder.Forwarder.KillDevice(self._adb, valgrind_tools.BaseTool()) 103 forwarder.Forwarder.KillDevice(self._adb, valgrind_tools.BaseTool())
94 if self._forwarder is not None: 104 if self._forwarder is not None:
95 self._forwarder.Close() 105 self._forwarder.Close()
96 106
97 #override 107 #override
98 def GetPassedJavaTestFilter(self): 108 def GetOS(self):
99 return _EXPECTATIONS['GetPassedJavaTestFilter']( 109 return 'android'
100 'android', self._chrome_version)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698