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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 self.assertEquals(404, expected.code) | 109 self.assertEquals(404, expected.code) |
| 110 | 110 |
| 111 def testCanStartChromeDriverOnSpecificPort(self): | 111 def testCanStartChromeDriverOnSpecificPort(self): |
| 112 launcher = ChromeDriverLauncher(port=9520) | 112 launcher = ChromeDriverLauncher(port=9520) |
| 113 self.assertEquals(9520, launcher.GetPort()) | 113 self.assertEquals(9520, launcher.GetPort()) |
| 114 driver = WebDriver(launcher.GetURL(), 'chrome', 'any') | 114 driver = WebDriver(launcher.GetURL(), 'chrome', 'any') |
| 115 driver.quit() | 115 driver.quit() |
| 116 launcher.Kill() | 116 launcher.Kill() |
| 117 | 117 |
| 118 | 118 |
| 119 class ScreenshotTest(unittest.TestCase): | |
| 120 """Tests to verify screenshot retrieval""" | |
| 121 | |
| 122 SEARCH = "http://www.google.com/webhp?hl=en" | |
| 123 NEWS = "http://www.google.com/news" | |
| 124 | |
| 125 def setUp(self): | |
| 126 self._launcher = ChromeDriverLauncher() | |
| 127 self._driver = WebDriver(self._launcher.GetURL(), 'chrome', 'any') | |
| 128 | |
| 129 def tearDown(self): | |
| 130 self._driver.quit() | |
| 131 self._launcher.Kill() | |
| 132 | |
| 133 def testScreenCapture | |
|
kkania
2011/03/07 18:15:17
there are a lot of errors in this script; please f
Joe
2011/03/11 22:12:48
refreshed
On 2011/03/07 18:15:17, kkania wrote:
| |
| 134 self._driver_.get(self.EARCH) | |
| 135 s1 = self._driver.get_screenshot_as_base64() | |
| 136 self._driver.get(self.NEWS) | |
| 137 s2 = self._driver.get_screenshot_as_base64() | |
| 138 self.assertTrue(len(s1) > 0 && (len)s2 > 0) | |
| 139 self.assertTrue(len(s1) != len(s2)) | |
| 140 | |
| 141 | |
| 119 class CookieTest(unittest.TestCase): | 142 class CookieTest(unittest.TestCase): |
| 120 """Cookie test for the json webdriver protocol""" | 143 """Cookie test for the json webdriver protocol""" |
| 121 | 144 |
| 122 SEARCH = "http://www.google.com/webhp?hl=en" | 145 SEARCH = "http://www.google.com/webhp?hl=en" |
| 123 | 146 |
| 124 def setUp(self): | 147 def setUp(self): |
| 125 self._launcher = ChromeDriverLauncher() | 148 self._launcher = ChromeDriverLauncher() |
| 126 self._driver = WebDriver(self._launcher.GetURL(), 'chrome', 'any') | 149 self._driver = WebDriver(self._launcher.GetURL(), 'chrome', 'any') |
| 127 | 150 |
| 128 def tearDown(self): | 151 def tearDown(self): |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 self.assertEquals('', url_parts[0]) | 298 self.assertEquals('', url_parts[0]) |
| 276 self.assertEquals('wd', url_parts[1]) | 299 self.assertEquals('wd', url_parts[1]) |
| 277 self.assertEquals('hub', url_parts[2]) | 300 self.assertEquals('hub', url_parts[2]) |
| 278 self.assertEquals('session', url_parts[3]) | 301 self.assertEquals('session', url_parts[3]) |
| 279 self.assertEquals(data['sessionId'], url_parts[4]) | 302 self.assertEquals(data['sessionId'], url_parts[4]) |
| 280 | 303 |
| 281 | 304 |
| 282 if __name__ == '__main__': | 305 if __name__ == '__main__': |
| 283 unittest.main(module='chromedriver_tests', | 306 unittest.main(module='chromedriver_tests', |
| 284 testRunner=GTestTextTestRunner(verbosity=1)) | 307 testRunner=GTestTextTestRunner(verbosity=1)) |
| OLD | NEW |