| OLD | NEW |
| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 """Override this method to launch browser differently. | 122 """Override this method to launch browser differently. |
| 123 | 123 |
| 124 Can be used to prevent launching the browser window by default in case a | 124 Can be used to prevent launching the browser window by default in case a |
| 125 test wants to do some additional setup before firing browser. | 125 test wants to do some additional setup before firing browser. |
| 126 """ | 126 """ |
| 127 self.SetUp() # Fire browser | 127 self.SetUp() # Fire browser |
| 128 | 128 |
| 129 def tearDown(self): | 129 def tearDown(self): |
| 130 self.TearDown() # Destroy browser | 130 self.TearDown() # Destroy browser |
| 131 | 131 |
| 132 @staticmethod |
| 133 def DataDir(): |
| 134 """Returns the path to the data dir chrome/test/data.""" |
| 135 return os.path.join(os.path.dirname(__file__), os.pardir, "data") |
| 136 |
| 132 def GetBookmarkModel(self): | 137 def GetBookmarkModel(self): |
| 133 """Return the bookmark model as a BookmarkModel object. | 138 """Return the bookmark model as a BookmarkModel object. |
| 134 | 139 |
| 135 This is a snapshot of the bookmark model; it is not a proxy and | 140 This is a snapshot of the bookmark model; it is not a proxy and |
| 136 does not get updated as the bookmark model changes. | 141 does not get updated as the bookmark model changes. |
| 137 """ | 142 """ |
| 138 return bookmark_model.BookmarkModel(self._GetBookmarksAsJSON()) | 143 return bookmark_model.BookmarkModel(self._GetBookmarksAsJSON()) |
| 139 | 144 |
| 140 | 145 |
| 141 class PyUITestSuite(pyautolib.PyUITestSuiteBase, unittest.TestSuite): | 146 class PyUITestSuite(pyautolib.PyUITestSuiteBase, unittest.TestSuite): |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 verbosity = 2 | 303 verbosity = 2 |
| 299 result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite) | 304 result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite) |
| 300 del loaded_tests # Need to destroy test cases before the suite | 305 del loaded_tests # Need to destroy test cases before the suite |
| 301 del pyauto_suite | 306 del pyauto_suite |
| 302 sys.exit(not result.wasSuccessful()) | 307 sys.exit(not result.wasSuccessful()) |
| 303 | 308 |
| 304 | 309 |
| 305 if __name__ == '__main__': | 310 if __name__ == '__main__': |
| 306 Main() | 311 Main() |
| 307 | 312 |
| OLD | NEW |