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

Side by Side Diff: chrome/test/pyautolib/pyauto.py

Issue 2117009: Fix a pref test -- Win/Linux don't have browser.show_page_options_buttons pref (Closed)
Patch Set: plat identification Created 10 years, 7 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
« no previous file with comments | « chrome/test/functional/prefs.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """PyAuto: Python Interface to Chromium's Automation Proxy. 7 """PyAuto: Python Interface to Chromium's Automation Proxy.
8 8
9 PyAuto uses swig to expose Automation Proxy interfaces to Python. 9 PyAuto uses swig to expose Automation Proxy interfaces to Python.
10 For complete documentation on the functionality available, 10 For complete documentation on the functionality available,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if sys.platform == 'win32': 172 if sys.platform == 'win32':
173 # Don't quote the ':' in drive letter ( say, C: ) on win. 173 # Don't quote the ':' in drive letter ( say, C: ) on win.
174 # Also, replace '\' with '/' as expected in a file:/// url. 174 # Also, replace '\' with '/' as expected in a file:/// url.
175 drive, rest = os.path.splitdrive(abs_path) 175 drive, rest = os.path.splitdrive(abs_path)
176 quoted_path = drive.upper() + urllib.quote((rest.replace('\\', '/'))) 176 quoted_path = drive.upper() + urllib.quote((rest.replace('\\', '/')))
177 return 'file:///' + quoted_path 177 return 'file:///' + quoted_path
178 else: 178 else:
179 quoted_path = urllib.quote(abs_path) 179 quoted_path = urllib.quote(abs_path)
180 return 'file://' + quoted_path 180 return 'file://' + quoted_path
181 181
182 @staticmethod
183 def IsMac():
184 """Are we on Mac?"""
185 return 'darwin' == sys.platform
186
187 @staticmethod
188 def IsLinux():
189 """Are we on Linux?"""
190 return 'linux2' == sys.platform
191
192 @staticmethod
193 def IsWin():
194 """Are we on Win?"""
195 return 'win32' == sys.platform
196
197 @staticmethod
198 def IsPosix():
199 """Are we on Mac/Linux?"""
200 return PyUITest.IsMac() or PyUITest.IsLinux()
201
182 def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): 202 def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]):
183 """Poll on a condition until timeout. 203 """Poll on a condition until timeout.
184 204
185 Waits until the |function| evalues to True or until |timeout| secs, 205 Waits until the |function| evalues to True or until |timeout| secs,
186 whichever occurs earlier. 206 whichever occurs earlier.
187 207
188 This is better than using a sleep, since it waits (almost) only as much 208 This is better than using a sleep, since it waits (almost) only as much
189 as needed. 209 as needed.
190 210
191 WARNING: This method call should be avoided as far as possible in favor 211 WARNING: This method call should be avoided as far as possible in favor
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 if self._options.verbose: 704 if self._options.verbose:
685 verbosity = 2 705 verbosity = 2
686 result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite) 706 result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite)
687 del loaded_tests # Need to destroy test cases before the suite 707 del loaded_tests # Need to destroy test cases before the suite
688 del pyauto_suite 708 del pyauto_suite
689 sys.exit(not result.wasSuccessful()) 709 sys.exit(not result.wasSuccessful())
690 710
691 711
692 if __name__ == '__main__': 712 if __name__ == '__main__':
693 Main() 713 Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/prefs.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698