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

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

Issue 7055004: File upload API in chromedriver (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed according to the code review Created 9 years, 7 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/file_path.h" 7 #include "base/file_path.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 DictionaryValue dict; 542 DictionaryValue dict;
543 dict.SetString("command", "SendOSLevelKeyEventToTab"); 543 dict.SetString("command", "SendOSLevelKeyEventToTab");
544 dict.SetInteger("windex", browser_index); 544 dict.SetInteger("windex", browser_index);
545 dict.SetInteger("tab_index", tab_index); 545 dict.SetInteger("tab_index", tab_index);
546 dict.SetInteger("keyCode", key_code); 546 dict.SetInteger("keyCode", key_code);
547 dict.SetInteger("modifiers", modifiers); 547 dict.SetInteger("modifiers", modifiers);
548 DictionaryValue reply_dict; 548 DictionaryValue reply_dict;
549 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 549 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg);
550 } 550 }
551 551
552 bool SendDragAndDropFilePathsJSONRequest(
553 AutomationMessageSender* sender,
554 int browser_index,
555 int tab_index,
556 int x,
557 int y,
558 const std::vector<std::string>& paths,
559 std::string* error_msg) {
560 DictionaryValue dict;
561 dict.SetString("command", "DragAndDropFilePaths");
562 dict.SetInteger("windex", browser_index);
563 dict.SetInteger("tab_index", tab_index);
564 dict.SetInteger("x", x);
565 dict.SetInteger("y", y);
566
567 ListValue* list_value = new ListValue();
568 for (size_t path_index = 0; path_index < paths.size(); ++path_index) {
569 list_value->Append(Value::CreateStringValue(paths[path_index]));
570 }
571 dict.Set("paths", list_value);
572
573 DictionaryValue reply_dict;
574 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg);
575 }
576
552 bool SendGetAppModalDialogMessageJSONRequest( 577 bool SendGetAppModalDialogMessageJSONRequest(
553 AutomationMessageSender* sender, 578 AutomationMessageSender* sender,
554 std::string* message, 579 std::string* message,
555 std::string* error_msg) { 580 std::string* error_msg) {
556 DictionaryValue dict; 581 DictionaryValue dict;
557 dict.SetString("command", "GetAppModalDialogMessage"); 582 dict.SetString("command", "GetAppModalDialogMessage");
558 DictionaryValue reply_dict; 583 DictionaryValue reply_dict;
559 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) 584 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg))
560 return false; 585 return false;
561 return reply_dict.GetString("message", message); 586 return reply_dict.GetString("message", message);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 AutomationMessageSender* sender, 622 AutomationMessageSender* sender,
598 int* version, 623 int* version,
599 std::string* error_msg) { 624 std::string* error_msg) {
600 DictionaryValue dict; 625 DictionaryValue dict;
601 dict.SetString("command", "GetChromeDriverAutomationVersion"); 626 dict.SetString("command", "GetChromeDriverAutomationVersion");
602 DictionaryValue reply_dict; 627 DictionaryValue reply_dict;
603 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) 628 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg))
604 return false; 629 return false;
605 return reply_dict.GetInteger("version", version); 630 return reply_dict.GetInteger("version", version);
606 } 631 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698