Index: chrome/browser/automation/testing_automation_provider.cc |
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc |
index 354a5607c491fafce05b331fed23dd0ee71b5d0b..114def87452b5e2f69f71d5be8fe2f96fc92d847 100644 |
--- a/chrome/browser/automation/testing_automation_provider.cc |
+++ b/chrome/browser/automation/testing_automation_provider.cc |
@@ -78,6 +78,7 @@ |
#include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" |
#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
+#include "chrome/browser/ui/browser_init.h" |
#include "chrome/browser/ui/browser_window.h" |
#include "chrome/browser/ui/find_bar/find_bar.h" |
#include "chrome/browser/ui/login/login_prompt.h" |
@@ -2213,6 +2214,8 @@ void TestingAutomationProvider::SendJSONRequest(int handle, |
&TestingAutomationProvider::GetChromeDriverAutomationVersion; |
handler_map["UpdateExtensionsNow"] = |
&TestingAutomationProvider::UpdateExtensionsNow; |
+ handler_map["CreateNewAutomationProvider"] = |
+ &TestingAutomationProvider::CreateNewAutomationProvider; |
#if defined(OS_CHROMEOS) |
handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; |
handler_map["ShowCreateAccountUI"] = |
@@ -6006,6 +6009,31 @@ void TestingAutomationProvider::GetChromeDriverAutomationVersion( |
AutomationJSONReply(this, reply_message).SendSuccess(&reply_dict); |
} |
+void TestingAutomationProvider::CreateNewAutomationProvider( |
+ DictionaryValue* args, |
+ IPC::Message* reply_message) { |
+ AutomationJSONReply reply(this, reply_message); |
+ std::string channel_id; |
+ if (!args->GetString("channel_id", &channel_id)) { |
+ reply.SendError("'channel_id' missing or invalid"); |
+ return; |
+ } |
+ |
+ AutomationProvider* provider = new TestingAutomationProvider(profile_); |
+ // TODO(kkania): Remove this when crbug.com/91311 is fixed. |
+ // Named server channels should ideally be created and closed on the file |
+ // thread, within the IPC channel code. |
+ base::ThreadRestrictions::ScopedAllowIO allow_io; |
+ if (!provider->InitializeChannel( |
+ automation::kNamedInterfacePrefix + channel_id)) { |
+ reply.SendError("Failed to initialize channel: " + channel_id); |
+ return; |
+ } |
+ provider->SetExpectedTabCount(0); |
Paweł Hajdan Jr.
2011/08/15 17:33:21
This duplicates code that initializes automation p
|
+ g_browser_process->InitAutomationProviderList()->AddProvider(provider); |
+ reply.SendSuccess(NULL); |
+} |
+ |
void TestingAutomationProvider::WaitForTabCountToBecome( |
int browser_handle, |
int target_tab_count, |