Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/test/webdriver/chromedriver_tests.py

Issue 6330012: Cookie commands for the webdriver protocol (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: minor fixes Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/webdriver/automation.cc ('k') | chrome/test/webdriver/commands/command.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 CookieTest(unittest.TestCase):
120 """Cookie test for the json webdriver protocol"""
121
122 SEARCH = "http://www.google.com/webhp?hl=en"
123
124 def setUp(self):
125 self._launcher = ChromeDriverLauncher()
126 self._driver = WebDriver(self._launcher.GetURL(), 'chrome', 'any')
127
128 def tearDown(self):
129 self._driver.quit()
130 self._launcher.Kill()
131
132 def testAddCookie(self):
133 self._driver.get(self.SEARCH)
134 cookie_dict = None
135 cookie_dict = self._driver.get_cookie("chromedriver_cookie_test")
136 cookie_dict = {}
137 cookie_dict["name"]= "chromedriver_cookie_test";
138 cookie_dict["value"] = "this is a test";
139 self._driver.add_cookie(cookie_dict)
140 cookie_dict = self._driver.get_cookie("chromedriver_cookie_test")
141 self.assertNotEqual(cookie_dict, None)
142 self.assertEqual(cookie_dict["value"], "this is a test");
143
144 def testDeleteCookie(self):
145 self.testAddCookie();
146 self._driver.delete_cookie("chromedriver_cookie_test")
147 cookie_dict = self._driver.get_cookie("chromedriver_cookie_test")
148 self.assertEqual(cookie_dict, None)
149
150
119 class SessionTest(unittest.TestCase): 151 class SessionTest(unittest.TestCase):
120 """Tests dealing with WebDriver sessions.""" 152 """Tests dealing with WebDriver sessions."""
121 153
122 def setUp(self): 154 def setUp(self):
123 self._launcher = ChromeDriverLauncher() 155 self._launcher = ChromeDriverLauncher()
124 156
125 def tearDown(self): 157 def tearDown(self):
126 self._launcher.Kill() 158 self._launcher.Kill()
127 159
128 def testCreatingSessionShouldRedirectToCorrectURL(self): 160 def testCreatingSessionShouldRedirectToCorrectURL(self):
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 drivers = [] 224 drivers = []
193 for i in range(10): 225 for i in range(10):
194 drivers += [WebDriver(self._launcher.GetURL(), 'chrome', 'any')] 226 drivers += [WebDriver(self._launcher.GetURL(), 'chrome', 'any')]
195 for driver in drivers: 227 for driver in drivers:
196 driver.quit() 228 driver.quit()
197 229
198 230
199 if __name__ == '__main__': 231 if __name__ == '__main__':
200 unittest.main(module='chromedriver_tests', 232 unittest.main(module='chromedriver_tests',
201 testRunner=GTestTextTestRunner(verbosity=1)) 233 testRunner=GTestTextTestRunner(verbosity=1))
OLDNEW
« no previous file with comments | « chrome/test/webdriver/automation.cc ('k') | chrome/test/webdriver/commands/command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698