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

Side by Side Diff: chrome/test/automation/automation_json_requests.cc

Issue 6705004: Return the full cookie details in TestingAutomationProvider and pass around (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 9 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
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/automation/automation_json_requests.h" 5 #include "chrome/test/automation/automation_json_requests.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 dict.SetInteger("windex", browser_index); 220 dict.SetInteger("windex", browser_index);
221 dict.SetInteger("tab_index", tab_index); 221 dict.SetInteger("tab_index", tab_index);
222 DictionaryValue reply_dict; 222 DictionaryValue reply_dict;
223 if (!SendAutomationJSONRequest(sender, dict, &reply_dict)) 223 if (!SendAutomationJSONRequest(sender, dict, &reply_dict))
224 return false; 224 return false;
225 return reply_dict.GetString("title", tab_title); 225 return reply_dict.GetString("title", tab_title);
226 } 226 }
227 227
228 bool SendGetCookiesJSONRequest( 228 bool SendGetCookiesJSONRequest(
229 AutomationMessageSender* sender, 229 AutomationMessageSender* sender,
230 const std::string& url,
231 ListValue** cookies) {
232 DictionaryValue dict;
233 dict.SetString("command", "GetCookies");
234 dict.SetString("url", url);
235 DictionaryValue reply_dict;
236 if (!SendAutomationJSONRequest(sender, dict, &reply_dict))
237 return false;
238 Value* cookies_unscoped_value;
239 if (!reply_dict.Remove("cookies", &cookies_unscoped_value))
240 return false;
241 scoped_ptr<Value> cookies_value(cookies_unscoped_value);
242 if (!cookies_value->IsType(Value::TYPE_LIST))
243 return false;
244 *cookies = static_cast<ListValue*>(cookies_value.release());
245 return true;
246 }
247
248 bool SendGetCookiesJSONRequestDeprecated(
249 AutomationMessageSender* sender,
230 int browser_index, 250 int browser_index,
231 const std::string& url, 251 const std::string& url,
232 std::string* cookies) { 252 std::string* cookies) {
233 DictionaryValue dict; 253 DictionaryValue dict;
234 dict.SetString("command", "GetCookies"); 254 dict.SetString("command", "GetCookies");
235 dict.SetInteger("windex", browser_index); 255 dict.SetInteger("windex", browser_index);
236 dict.SetString("url", url); 256 dict.SetString("url", url);
237 DictionaryValue reply_dict; 257 DictionaryValue reply_dict;
238 if (!SendAutomationJSONRequest(sender, dict, &reply_dict)) 258 if (!SendAutomationJSONRequest(sender, dict, &reply_dict))
239 return false; 259 return false;
240 return reply_dict.GetString("cookies", cookies); 260 return reply_dict.GetString("cookies", cookies);
241 } 261 }
242 262
243 bool SendDeleteCookieJSONRequest( 263 bool SendDeleteCookieJSONRequest(
244 AutomationMessageSender* sender, 264 AutomationMessageSender* sender,
265 const std::string& url,
266 const std::string& cookie_name) {
267 DictionaryValue dict;
268 dict.SetString("command", "DeleteCookie");
269 dict.SetString("url", url);
270 dict.SetString("name", cookie_name);
271 DictionaryValue reply_dict;
272 return SendAutomationJSONRequest(sender, dict, &reply_dict);
273 }
274
275 bool SendDeleteCookieJSONRequestDeprecated(
276 AutomationMessageSender* sender,
245 int browser_index, 277 int browser_index,
246 const std::string& url, 278 const std::string& url,
247 const std::string& cookie_name) { 279 const std::string& cookie_name) {
248 DictionaryValue dict; 280 DictionaryValue dict;
249 dict.SetString("command", "DeleteCookie"); 281 dict.SetString("command", "DeleteCookie");
250 dict.SetInteger("windex", browser_index); 282 dict.SetInteger("windex", browser_index);
251 dict.SetString("url", url); 283 dict.SetString("url", url);
252 dict.SetString("name", cookie_name); 284 dict.SetString("name", cookie_name);
253 DictionaryValue reply_dict; 285 DictionaryValue reply_dict;
254 return SendAutomationJSONRequest(sender, dict, &reply_dict); 286 return SendAutomationJSONRequest(sender, dict, &reply_dict);
255 } 287 }
256 288
257 bool SendSetCookieJSONRequest( 289 bool SendSetCookieJSONRequest(
258 AutomationMessageSender* sender, 290 AutomationMessageSender* sender,
291 const std::string& url,
292 DictionaryValue* cookie_dict) {
293 DictionaryValue dict;
294 dict.SetString("command", "SetCookie");
295 dict.SetString("url", url);
296 dict.Set("cookie", cookie_dict->DeepCopy());
297 DictionaryValue reply_dict;
298 return SendAutomationJSONRequest(sender, dict, &reply_dict);
299 }
300
301 bool SendSetCookieJSONRequestDeprecated(
302 AutomationMessageSender* sender,
259 int browser_index, 303 int browser_index,
260 const std::string& url, 304 const std::string& url,
261 const std::string& cookie) { 305 const std::string& cookie) {
262 DictionaryValue dict; 306 DictionaryValue dict;
263 dict.SetString("command", "SetCookie"); 307 dict.SetString("command", "SetCookie");
264 dict.SetInteger("windex", browser_index); 308 dict.SetInteger("windex", browser_index);
265 dict.SetString("url", url); 309 dict.SetString("url", url);
266 dict.SetString("cookie", cookie); 310 dict.SetString("cookie", cookie);
267 DictionaryValue reply_dict; 311 DictionaryValue reply_dict;
268 return SendAutomationJSONRequest(sender, dict, &reply_dict); 312 return SendAutomationJSONRequest(sender, dict, &reply_dict);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return SendAutomationJSONRequest(sender, dict, &reply_dict); 433 return SendAutomationJSONRequest(sender, dict, &reply_dict);
390 } 434 }
391 435
392 bool SendWaitForAllTabsToStopLoadingJSONRequest( 436 bool SendWaitForAllTabsToStopLoadingJSONRequest(
393 AutomationMessageSender* sender) { 437 AutomationMessageSender* sender) {
394 DictionaryValue dict; 438 DictionaryValue dict;
395 dict.SetString("command", "WaitForAllTabsToStopLoading"); 439 dict.SetString("command", "WaitForAllTabsToStopLoading");
396 DictionaryValue reply_dict; 440 DictionaryValue reply_dict;
397 return SendAutomationJSONRequest(sender, dict, &reply_dict); 441 return SendAutomationJSONRequest(sender, dict, &reply_dict);
398 } 442 }
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_json_requests.h ('k') | chrome/test/webdriver/WEBDRIVER_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698