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

Unified Diff: chrome/test/webdriver/webdriver_session.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: bind 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/webdriver/webdriver_session.cc
diff --git a/chrome/test/webdriver/webdriver_session.cc b/chrome/test/webdriver/webdriver_session.cc
index 74ad4a1877e7c5f5144366045af59f52248022df..9ea256dd61bf410ea1e6a82e4ec83698e11fc80c 100644
--- a/chrome/test/webdriver/webdriver_session.cc
+++ b/chrome/test/webdriver/webdriver_session.cc
@@ -7,6 +7,8 @@
#include <sstream>
#include <vector>
+#include "base/bind.h"
+#include "base/callback.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -997,12 +999,35 @@ Error* Session::WaitForAllTabsToStopLoading() {
return error;
}
-Error* Session::InstallExtension(const FilePath& path) {
+Error* Session::InstallExtensionDeprecated(const FilePath& path) {
Error* error = NULL;
RunSessionTask(NewRunnableMethod(
automation_.get(),
+ &Automation::InstallExtensionDeprecated,
+ path,
+ &error));
+ return error;
+}
+
+Error* Session::GetInstalledExtensions(
+ std::vector<std::string>* extension_ids) {
+ Error* error = NULL;
+ RunSessionTask(base::Bind(
+ &Automation::GetInstalledExtensions,
+ base::Unretained(automation_.get()),
+ extension_ids,
+ &error));
+ return error;
+}
+
+Error* Session::InstallExtension(
+ const FilePath& path, std::string* extension_id) {
+ Error* error = NULL;
+ RunSessionTask(base::Bind(
&Automation::InstallExtension,
+ base::Unretained(automation_.get()),
path,
+ extension_id,
&error));
return error;
}
@@ -1056,6 +1081,21 @@ void Session::RunSessionTaskOnSessionThread(Task* task,
done_event->Signal();
}
+void Session::RunSessionTask(const base::Closure& task) {
+ base::WaitableEvent done_event(false, false);
+ thread_.message_loop_proxy()->PostTask(FROM_HERE, base::Bind(
+ &Session::RunClosureOnSessionThread,
+ base::Unretained(this),
+ task,
+ &done_event));
+ done_event.Wait();
+}
+
+void Session::RunClosureOnSessionThread(const base::Closure& task,
+ base::WaitableEvent* done_event) {
+ task.Run();
+ done_event->Signal();
+}
void Session::InitOnSessionThread(const Automation::BrowserOptions& options,
Error** error) {
« chrome/test/webdriver/commands/chrome_commands.h ('K') | « chrome/test/webdriver/webdriver_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698