| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 json | 9 import json |
| 10 import math | 10 import math |
| (...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 self.assertEquals(window1_handle, driver.GetCurrentWindowHandle()) | 2121 self.assertEquals(window1_handle, driver.GetCurrentWindowHandle()) |
| 2122 | 2122 |
| 2123 # Test whether first window has old or new network conditions. | 2123 # Test whether first window has old or new network conditions. |
| 2124 network = driver.GetNetworkConnection() | 2124 network = driver.GetNetworkConnection() |
| 2125 self.assertEquals(network, connection_type) | 2125 self.assertEquals(network, connection_type) |
| 2126 | 2126 |
| 2127 def testW3cCompliantResponses(self): | 2127 def testW3cCompliantResponses(self): |
| 2128 # Asserts that chromedriver has received the correct response. | 2128 # Asserts that chromedriver has received the correct response. |
| 2129 # W3C compliant responses should only be received when the capability has | 2129 # W3C compliant responses should only be received when the capability has |
| 2130 # been set and the request was sent in the correct format. | 2130 # been set and the request was sent in the correct format. |
| 2131 driver = self.CreateDriver(send_w3c_request=True) | 2131 driver = self.CreateDriver() |
| 2132 self.assertFalse(driver.w3c_compliant) | 2132 self.assertFalse(driver.w3c_compliant) |
| 2133 | 2133 |
| 2134 driver = self.CreateDriver(send_w3c_capability=True) | 2134 driver = self.CreateDriver(send_w3c_request=True) |
| 2135 self.assertFalse(driver.w3c_compliant) | |
| 2136 | |
| 2137 driver = self.CreateDriver(send_w3c_capability=True, send_w3c_request=True) | |
| 2138 self.assertTrue(driver.w3c_compliant) | 2135 self.assertTrue(driver.w3c_compliant) |
| 2139 | 2136 |
| 2140 # Asserts that errors are being raised correctly in the test client | 2137 # Asserts that errors are being raised correctly in the test client |
| 2141 # with a w3c compliant driver. | 2138 # with a w3c compliant driver. |
| 2142 self.assertRaises(chromedriver.UnknownError, | 2139 self.assertRaises(chromedriver.UnknownError, |
| 2143 driver.GetNetworkConnection) | 2140 driver.GetNetworkConnection) |
| 2144 | 2141 |
| 2145 def testNonCompliantByDefault(self): | 2142 def testNonCompliantByDefault(self): |
| 2146 driver = self.CreateDriver(); | 2143 driver = self.CreateDriver(); |
| 2147 self.assertFalse(driver.w3c_compliant) | 2144 self.assertFalse(driver.w3c_compliant) |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 | 2408 |
| 2412 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( | 2409 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( |
| 2413 sys.modules[__name__]) | 2410 sys.modules[__name__]) |
| 2414 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) | 2411 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) |
| 2415 ChromeDriverTest.GlobalSetUp() | 2412 ChromeDriverTest.GlobalSetUp() |
| 2416 MobileEmulationCapabilityTest.GlobalSetUp() | 2413 MobileEmulationCapabilityTest.GlobalSetUp() |
| 2417 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests) | 2414 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests) |
| 2418 ChromeDriverTest.GlobalTearDown() | 2415 ChromeDriverTest.GlobalTearDown() |
| 2419 MobileEmulationCapabilityTest.GlobalTearDown() | 2416 MobileEmulationCapabilityTest.GlobalTearDown() |
| 2420 sys.exit(len(result.failures) + len(result.errors)) | 2417 sys.exit(len(result.failures) + len(result.errors)) |
| OLD | NEW |