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

Unified Diff: chrome/test/automation/automation_json_requests.cc

Issue 8649004: Allow chromedriver to install an extension and get all installed extension IDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/automation/automation_json_requests.cc
diff --git a/chrome/test/automation/automation_json_requests.cc b/chrome/test/automation/automation_json_requests.cc
index 76e8d2d61ac14286df39f62406af7cc1091edbeb..c31127b6b28de0e31be2db91df362eb8bc76243f 100644
--- a/chrome/test/automation/automation_json_requests.cc
+++ b/chrome/test/automation/automation_json_requests.cc
@@ -18,6 +18,9 @@
#include "chrome/common/automation_messages.h"
#include "chrome/test/automation/automation_proxy.h"
+using base::DictionaryValue;
+using base::ListValue;
+
namespace {
bool SendAutomationJSONRequest(AutomationMessageSender* sender,
@@ -609,3 +612,39 @@ bool SendGetChromeDriverAutomationVersion(
return false;
return reply_dict.GetInteger("version", version);
}
+
+bool SendGetExtensionsInfoJSONRequest(
+ AutomationMessageSender* sender,
+ ListValue* extensions_list,
+ std::string* error_msg) {
+ DictionaryValue dict;
+ dict.SetString("command", "GetExtensionsInfo");
+ DictionaryValue reply_dict;
+ if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg))
+ return false;
+ ListValue* extensions_list_swap;
+ if (!reply_dict.GetList("extensions", &extensions_list_swap)) {
+ *error_msg = "Missing or invalid 'extensions'";
+ return false;
+ }
+ extensions_list->Swap(extensions_list_swap);
+ return true;
+}
+
+bool SendInstallExtensionJSONRequest(
+ AutomationMessageSender* sender,
+ const FilePath& path,
+ std::string* extension_id,
+ std::string* error_msg) {
+ DictionaryValue dict;
+ dict.SetString("command", "InstallExtension");
+ dict.SetString("path", path.value());
+ DictionaryValue reply_dict;
+ if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg))
+ return false;
+ if (!reply_dict.GetString("id", extension_id)) {
+ *error_msg = "Missing or invalid 'id'";
+ return false;
+ }
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698