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

Side by Side Diff: chrome/test/webdriver/session.cc

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/session.h ('k') | chrome/test/webdriver/webdriver_remote_tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/test/webdriver/session_manager.h" 5 #include "chrome/test/webdriver/session_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "base/process.h" 13 #include "base/process.h"
14 #include "base/process_util.h" 14 #include "base/process_util.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/json/json_reader.h" 16 #include "base/json/json_reader.h"
17 #include "base/json/json_writer.h" 17 #include "base/json/json_writer.h"
18 #include "base/test/test_timeouts.h" 18 #include "base/test/test_timeouts.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/app/chrome_command_ids.h" 20 #include "chrome/app/chrome_command_ids.h"
21 #include "chrome/common/chrome_constants.h" 21 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/test/test_launcher_utils.h" 23 #include "chrome/test/test_launcher_utils.h"
24 #include "chrome/test/webdriver/utility_functions.h" 24 #include "chrome/test/webdriver/utility_functions.h"
25 #include "chrome/test/webdriver/webdriver_key_converter.h" 25 #include "chrome/test/webdriver/webdriver_key_converter.h"
26 #include "googleurl/src/gurl.h"
26 #include "third_party/webdriver/atoms.h" 27 #include "third_party/webdriver/atoms.h"
27 28
28 namespace webdriver { 29 namespace webdriver {
29 30
30 Session::Session(const std::string& id) 31 Session::Session(const std::string& id)
31 : thread_(id.c_str()), 32 : thread_(id.c_str()),
32 id_(id), 33 id_(id),
33 window_num_(0), 34 window_num_(0),
34 implicit_wait_(0), 35 implicit_wait_(0),
35 current_frame_xpath_("") { 36 current_frame_xpath_("") {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 bool Session::GetURL(std::string* url) { 191 bool Session::GetURL(std::string* url) {
191 bool success = false; 192 bool success = false;
192 RunSessionTask(NewRunnableMethod( 193 RunSessionTask(NewRunnableMethod(
193 automation_.get(), 194 automation_.get(),
194 &Automation::GetURL, 195 &Automation::GetURL,
195 url, 196 url,
196 &success)); 197 &success));
197 return success; 198 return success;
198 } 199 }
199 200
201 bool Session::GetURL(GURL* gurl) {
202 bool success = false;
203 RunSessionTask(NewRunnableMethod(
204 automation_.get(),
205 &Automation::GetGURL,
206 gurl,
207 &success));
208 return success;
209 }
210
200 bool Session::GetTabTitle(std::string* tab_title) { 211 bool Session::GetTabTitle(std::string* tab_title) {
201 bool success = false; 212 bool success = false;
202 RunSessionTask(NewRunnableMethod( 213 RunSessionTask(NewRunnableMethod(
203 automation_.get(), 214 automation_.get(),
204 &Automation::GetTabTitle, 215 &Automation::GetTabTitle,
205 tab_title, 216 tab_title,
206 &success)); 217 &success));
207 return success; 218 return success;
208 } 219 }
209 220
221 bool Session::GetCookies(const GURL& url, std::string* cookies) {
222 bool success = false;
223 RunSessionTask(NewRunnableMethod(
224 automation_.get(),
225 &Automation::GetCookies,
226 url,
227 cookies,
228 &success));
229 return success;
230 }
231
232 bool Session::GetCookieByName(const GURL& url,
233 const std::string& cookie_name,
234 std::string* cookie) {
235 bool success = false;
236 RunSessionTask(NewRunnableMethod(
237 automation_.get(),
238 &Automation::GetCookieByName,
239 url,
240 cookie_name,
241 cookie,
242 &success));
243 return success;
244 }
245
246 bool Session::DeleteCookie(const GURL& url, const std::string& cookie_name) {
247 bool success = false;
248 RunSessionTask(NewRunnableMethod(
249 automation_.get(),
250 &Automation::DeleteCookie,
251 url,
252 cookie_name,
253 &success));
254 return success;
255 }
256
257 bool Session::SetCookie(const GURL& url, const std::string& cookie) {
258 bool success = false;
259 RunSessionTask(NewRunnableMethod(
260 automation_.get(),
261 &Automation::SetCookie,
262 url,
263 cookie,
264 &success));
265 return success;
266 }
267
210 void Session::RunSessionTask(Task* task) { 268 void Session::RunSessionTask(Task* task) {
211 base::WaitableEvent done_event(false, false); 269 base::WaitableEvent done_event(false, false);
212 thread_.message_loop_proxy()->PostTask(FROM_HERE, NewRunnableMethod( 270 thread_.message_loop_proxy()->PostTask(FROM_HERE, NewRunnableMethod(
213 this, 271 this,
214 &Session::RunSessionTaskOnSessionThread, 272 &Session::RunSessionTaskOnSessionThread,
215 task, 273 task,
216 &done_event)); 274 &done_event));
217 done_event.Wait(); 275 done_event.Wait();
218 } 276 }
219 277
(...skipping 28 matching lines...) Expand all
248 << "KeyCode: " << key_events[i].key_code << "\n" 306 << "KeyCode: " << key_events[i].key_code << "\n"
249 << "UnmodifiedText: " << key_events[i].unmodified_text << "\n" 307 << "UnmodifiedText: " << key_events[i].unmodified_text << "\n"
250 << "ModifiedText: " << key_events[i].modified_text << "\n" 308 << "ModifiedText: " << key_events[i].modified_text << "\n"
251 << "Modifiers: " << key_events[i].modifiers << "\n"; 309 << "Modifiers: " << key_events[i].modifiers << "\n";
252 *success = false; 310 *success = false;
253 } 311 }
254 } 312 }
255 } 313 }
256 314
257 } // namespace webdriver 315 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/session.h ('k') | chrome/test/webdriver/webdriver_remote_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698