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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 7634031: Let pyauto create an attached webdriver instance to manipulate web pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forgot to re-add the previously added files Created 9 years, 4 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/browser/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "chrome/browser/tab_contents/link_infobar_delegate.h" 71 #include "chrome/browser/tab_contents/link_infobar_delegate.h"
72 #include "chrome/browser/themes/theme_service.h" 72 #include "chrome/browser/themes/theme_service.h"
73 #include "chrome/browser/themes/theme_service_factory.h" 73 #include "chrome/browser/themes/theme_service_factory.h"
74 #include "chrome/browser/translate/translate_infobar_delegate.h" 74 #include "chrome/browser/translate/translate_infobar_delegate.h"
75 #include "chrome/browser/translate/translate_tab_helper.h" 75 #include "chrome/browser/translate/translate_tab_helper.h"
76 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 76 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
77 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" 77 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
78 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" 78 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
79 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 79 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
80 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 80 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
81 #include "chrome/browser/ui/browser_init.h"
81 #include "chrome/browser/ui/browser_window.h" 82 #include "chrome/browser/ui/browser_window.h"
82 #include "chrome/browser/ui/find_bar/find_bar.h" 83 #include "chrome/browser/ui/find_bar/find_bar.h"
83 #include "chrome/browser/ui/login/login_prompt.h" 84 #include "chrome/browser/ui/login/login_prompt.h"
84 #include "chrome/browser/ui/omnibox/location_bar.h" 85 #include "chrome/browser/ui/omnibox/location_bar.h"
85 #include "chrome/browser/ui/omnibox/omnibox_view.h" 86 #include "chrome/browser/ui/omnibox/omnibox_view.h"
86 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" 87 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
87 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 88 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
88 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" 89 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h"
89 #include "chrome/common/automation_messages.h" 90 #include "chrome/common/automation_messages.h"
90 #include "chrome/common/chrome_constants.h" 91 #include "chrome/common/chrome_constants.h"
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 handler_map["ActivateTab"] = 2207 handler_map["ActivateTab"] =
2207 &TestingAutomationProvider::ActivateTabJSON; 2208 &TestingAutomationProvider::ActivateTabJSON;
2208 handler_map["GetAppModalDialogMessage"] = 2209 handler_map["GetAppModalDialogMessage"] =
2209 &TestingAutomationProvider::GetAppModalDialogMessage; 2210 &TestingAutomationProvider::GetAppModalDialogMessage;
2210 handler_map["AcceptOrDismissAppModalDialog"] = 2211 handler_map["AcceptOrDismissAppModalDialog"] =
2211 &TestingAutomationProvider::AcceptOrDismissAppModalDialog; 2212 &TestingAutomationProvider::AcceptOrDismissAppModalDialog;
2212 handler_map["GetChromeDriverAutomationVersion"] = 2213 handler_map["GetChromeDriverAutomationVersion"] =
2213 &TestingAutomationProvider::GetChromeDriverAutomationVersion; 2214 &TestingAutomationProvider::GetChromeDriverAutomationVersion;
2214 handler_map["UpdateExtensionsNow"] = 2215 handler_map["UpdateExtensionsNow"] =
2215 &TestingAutomationProvider::UpdateExtensionsNow; 2216 &TestingAutomationProvider::UpdateExtensionsNow;
2217 handler_map["CreateNewAutomationProvider"] =
2218 &TestingAutomationProvider::CreateNewAutomationProvider;
2216 #if defined(OS_CHROMEOS) 2219 #if defined(OS_CHROMEOS)
2217 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; 2220 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo;
2218 handler_map["ShowCreateAccountUI"] = 2221 handler_map["ShowCreateAccountUI"] =
2219 &TestingAutomationProvider::ShowCreateAccountUI; 2222 &TestingAutomationProvider::ShowCreateAccountUI;
2220 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; 2223 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest;
2221 handler_map["Login"] = &TestingAutomationProvider::Login; 2224 handler_map["Login"] = &TestingAutomationProvider::Login;
2222 2225
2223 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen; 2226 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen;
2224 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen; 2227 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen;
2225 handler_map["SignoutInScreenLocker"] = 2228 handler_map["SignoutInScreenLocker"] =
(...skipping 3773 matching lines...) Expand 10 before | Expand all | Expand 10 after
5999 } 6002 }
6000 6003
6001 void TestingAutomationProvider::GetChromeDriverAutomationVersion( 6004 void TestingAutomationProvider::GetChromeDriverAutomationVersion(
6002 DictionaryValue* args, 6005 DictionaryValue* args,
6003 IPC::Message* reply_message) { 6006 IPC::Message* reply_message) {
6004 DictionaryValue reply_dict; 6007 DictionaryValue reply_dict;
6005 reply_dict.SetInteger("version", automation::kChromeDriverAutomationVersion); 6008 reply_dict.SetInteger("version", automation::kChromeDriverAutomationVersion);
6006 AutomationJSONReply(this, reply_message).SendSuccess(&reply_dict); 6009 AutomationJSONReply(this, reply_message).SendSuccess(&reply_dict);
6007 } 6010 }
6008 6011
6012 void TestingAutomationProvider::CreateNewAutomationProvider(
6013 DictionaryValue* args,
6014 IPC::Message* reply_message) {
6015 AutomationJSONReply reply(this, reply_message);
6016 std::string channel_id;
6017 if (!args->GetString("channel_id", &channel_id)) {
6018 reply.SendError("'channel_id' missing or invalid");
6019 return;
6020 }
6021
6022 AutomationProvider* provider = new TestingAutomationProvider(profile_);
6023 // TODO(kkania): Remove this when crbug.com/91311 is fixed.
6024 // Named server channels should ideally be created and closed on the file
6025 // thread, within the IPC channel code.
6026 base::ThreadRestrictions::ScopedAllowIO allow_io;
6027 if (!provider->InitializeChannel(
6028 automation::kNamedInterfacePrefix + channel_id)) {
6029 reply.SendError("Failed to initialize channel: " + channel_id);
6030 return;
6031 }
6032 provider->SetExpectedTabCount(0);
Paweł Hajdan Jr. 2011/08/15 17:33:21 This duplicates code that initializes automation p
6033 g_browser_process->InitAutomationProviderList()->AddProvider(provider);
6034 reply.SendSuccess(NULL);
6035 }
6036
6009 void TestingAutomationProvider::WaitForTabCountToBecome( 6037 void TestingAutomationProvider::WaitForTabCountToBecome(
6010 int browser_handle, 6038 int browser_handle,
6011 int target_tab_count, 6039 int target_tab_count,
6012 IPC::Message* reply_message) { 6040 IPC::Message* reply_message) {
6013 if (!browser_tracker_->ContainsHandle(browser_handle)) { 6041 if (!browser_tracker_->ContainsHandle(browser_handle)) {
6014 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message, 6042 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message,
6015 false); 6043 false);
6016 Send(reply_message); 6044 Send(reply_message);
6017 return; 6045 return;
6018 } 6046 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
6153 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); 6181 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl);
6154 6182
6155 Send(reply_message_); 6183 Send(reply_message_);
6156 redirect_query_ = 0; 6184 redirect_query_ = 0;
6157 reply_message_ = NULL; 6185 reply_message_ = NULL;
6158 } 6186 }
6159 6187
6160 void TestingAutomationProvider::OnRemoveProvider() { 6188 void TestingAutomationProvider::OnRemoveProvider() {
6161 AutomationProviderList::GetInstance()->RemoveProvider(this); 6189 AutomationProviderList::GetInstance()->RemoveProvider(this);
6162 } 6190 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/test/automation/automation_proxy_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698