OLD | NEW |
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 """End to end tests for ChromeDriver.""" | 5 """End to end tests for ChromeDriver.""" |
6 | 6 |
7 import ctypes | 7 import ctypes |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import unittest | 10 import unittest |
11 | 11 |
12 import chromedriver | 12 import chromedriver |
13 | 13 |
14 | 14 |
15 class ChromeDriverTest(unittest.TestCase): | 15 class ChromeDriverTest(unittest.TestCase): |
16 """End to end tests for ChromeDriver.""" | 16 """End to end tests for ChromeDriver.""" |
17 | 17 |
18 def testStartStop(self): | 18 def testStartStop(self): |
19 driver = chromedriver.ChromeDriver(_CHROMEDRIVER_LIB, _CHROME_BINARY) | 19 driver = chromedriver.ChromeDriver(_CHROMEDRIVER_LIB, _CHROME_BINARY) |
20 driver.Quit() | 20 driver.Quit() |
21 | 21 |
| 22 def testLoadUrl(self): |
| 23 driver = chromedriver.ChromeDriver(_CHROMEDRIVER_LIB) |
| 24 driver.Load('http://www.google.com') |
| 25 driver.Quit() |
| 26 |
| 27 |
22 if __name__ == '__main__': | 28 if __name__ == '__main__': |
23 if len(sys.argv) != 2 and len(sys.argv) != 3: | 29 if len(sys.argv) != 2 and len(sys.argv) != 3: |
24 print ('Usage: %s <path_to_chromedriver_so> [path_to_chrome_binary]' % | 30 print ('Usage: %s <path_to_chromedriver_so> [path_to_chrome_binary]' % |
25 __file__) | 31 __file__) |
26 sys.exit(1) | 32 sys.exit(1) |
27 global _CHROMEDRIVER_LIB | 33 global _CHROMEDRIVER_LIB |
28 _CHROMEDRIVER_LIB = os.path.abspath(sys.argv[1]) | 34 _CHROMEDRIVER_LIB = os.path.abspath(sys.argv[1]) |
29 global _CHROME_BINARY | 35 global _CHROME_BINARY |
30 if len(sys.argv) == 3: | 36 if len(sys.argv) == 3: |
31 _CHROME_BINARY = os.path.abspath(sys.argv[2]) | 37 _CHROME_BINARY = os.path.abspath(sys.argv[2]) |
32 else: | 38 else: |
33 _CHROME_BINARY = None | 39 _CHROME_BINARY = None |
34 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( | 40 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( |
35 sys.modules[__name__]) | 41 sys.modules[__name__]) |
36 result = unittest.TextTestRunner().run(all_tests_suite) | 42 result = unittest.TextTestRunner().run(all_tests_suite) |
37 sys.exit(len(result.failures) + len(result.errors)) | 43 sys.exit(len(result.failures) + len(result.errors)) |
OLD | NEW |