Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 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 """Tests for ChromeDriver. | 7 """Tests for ChromeDriver. |
| 8 | 8 |
| 9 If your test is testing a specific part of the WebDriver API, consider adding | 9 If your test is testing a specific part of the WebDriver API, consider adding |
| 10 it to the appropriate place in the WebDriver tree instead. | 10 it to the appropriate place in the WebDriver tree instead. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 self.assertEquals('POST', expected.hdrs['Allow']) | 101 self.assertEquals('POST', expected.hdrs['Allow']) |
| 102 | 102 |
| 103 def testShouldGetA404WhenAttemptingToDeleteAnUnknownSession(self): | 103 def testShouldGetA404WhenAttemptingToDeleteAnUnknownSession(self): |
| 104 request_url = self._launcher.GetURL() + '/session/unkown_session_id' | 104 request_url = self._launcher.GetURL() + '/session/unkown_session_id' |
| 105 try: | 105 try: |
| 106 SendRequest(request_url, method='DELETE') | 106 SendRequest(request_url, method='DELETE') |
| 107 self.fail('Should have raised a urllib.HTTPError for returned 404') | 107 self.fail('Should have raised a urllib.HTTPError for returned 404') |
| 108 except urllib2.HTTPError, expected: | 108 except urllib2.HTTPError, expected: |
| 109 self.assertEquals(404, expected.code) | 109 self.assertEquals(404, expected.code) |
| 110 | 110 |
| 111 class BasicServerTest(unittest.TestCase): | |
| 111 def testCanStartChromeDriverOnSpecificPort(self): | 112 def testCanStartChromeDriverOnSpecificPort(self): |
| 112 launcher = ChromeDriverLauncher(port=9520) | 113 launcher = ChromeDriverLauncher(port=9520) |
| 113 self.assertEquals(9520, launcher.GetPort()) | 114 self.assertEquals(9520, launcher.GetPort()) |
| 114 driver = WebDriver(launcher.GetURL(), 'chrome', 'any') | 115 driver = WebDriver(launcher.GetURL(), 'chrome', 'any') |
| 115 driver.quit() | 116 driver.quit() |
| 116 launcher.Kill() | 117 launcher.Kill() |
| 117 | 118 |
| 119 def testCanStartChromeWithNativeEventsEnabled(self): | |
| 120 launcher = ChromeDriverLauncher(use_native_events=True) | |
| 121 self.assertTrue(launcher.GetUseNativeEvents()) | |
| 122 driver = WebDriver(launcher.GetURL(), 'chrome', 'any') | |
|
Jason Leyba
2011/03/04 19:25:12
You're not verifying that the server has actually
timothe faudot
2011/03/07 02:45:26
This test only ensures that we can start the serve
Jason Leyba
2011/03/07 03:32:56
That's my point - you're only testing that you can
| |
| 123 driver.quit() | |
| 124 launcher.Kill() | |
| 125 | |
| 118 | 126 |
| 119 class CookieTest(unittest.TestCase): | 127 class CookieTest(unittest.TestCase): |
| 120 """Cookie test for the json webdriver protocol""" | 128 """Cookie test for the json webdriver protocol""" |
| 121 | 129 |
| 122 SEARCH = "http://www.google.com/webhp?hl=en" | 130 SEARCH = "http://www.google.com/webhp?hl=en" |
| 123 | 131 |
| 124 def setUp(self): | 132 def setUp(self): |
| 125 self._launcher = ChromeDriverLauncher() | 133 self._launcher = ChromeDriverLauncher() |
| 126 self._driver = WebDriver(self._launcher.GetURL(), 'chrome', 'any') | 134 self._driver = WebDriver(self._launcher.GetURL(), 'chrome', 'any') |
| 127 | 135 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 self.assertEquals('', url_parts[0]) | 283 self.assertEquals('', url_parts[0]) |
| 276 self.assertEquals('wd', url_parts[1]) | 284 self.assertEquals('wd', url_parts[1]) |
| 277 self.assertEquals('hub', url_parts[2]) | 285 self.assertEquals('hub', url_parts[2]) |
| 278 self.assertEquals('session', url_parts[3]) | 286 self.assertEquals('session', url_parts[3]) |
| 279 self.assertEquals(data['sessionId'], url_parts[4]) | 287 self.assertEquals(data['sessionId'], url_parts[4]) |
| 280 | 288 |
| 281 | 289 |
| 282 if __name__ == '__main__': | 290 if __name__ == '__main__': |
| 283 unittest.main(module='chromedriver_tests', | 291 unittest.main(module='chromedriver_tests', |
| 284 testRunner=GTestTextTestRunner(verbosity=1)) | 292 testRunner=GTestTextTestRunner(verbosity=1)) |
| OLD | NEW |