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

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

Issue 10257015: Added a new automation hook ExecuteJavascriptInOOBEWebUI() to execute javascript prior to login on… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed hook and updated doc strings. Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 bool* visible) { 1305 bool* visible) {
1306 *visible = false; 1306 *visible = false;
1307 1307
1308 if (browser_tracker_->ContainsHandle(handle)) { 1308 if (browser_tracker_->ContainsHandle(handle)) {
1309 Browser* browser = browser_tracker_->GetResource(handle); 1309 Browser* browser = browser_tracker_->GetResource(handle);
1310 if (browser) 1310 if (browser)
1311 *visible = browser->window()->IsFullscreenBubbleVisible(); 1311 *visible = browser->window()->IsFullscreenBubbleVisible();
1312 } 1312 }
1313 } 1313 }
1314 1314
1315 namespace { 1315 void TestingAutomationProvider::ExecuteJavascriptInRenderViewFrame(
1316
1317 void ExecuteJavascriptInRenderViewFrame(
1318 const string16& frame_xpath, 1316 const string16& frame_xpath,
1319 const string16& script, 1317 const string16& script,
1320 IPC::Message* reply_message, 1318 IPC::Message* reply_message,
1321 RenderViewHost* render_view_host) { 1319 RenderViewHost* render_view_host) {
1322 // Set the routing id of this message with the controller. 1320 // Set the routing id of this message with the controller.
1323 // This routing id needs to be remembered for the reverse 1321 // This routing id needs to be remembered for the reverse
1324 // communication while sending back the response of 1322 // communication while sending back the response of
1325 // this javascript execution. 1323 // this javascript execution.
1326 render_view_host->ExecuteJavascriptInWebFrame( 1324 render_view_host->ExecuteJavascriptInWebFrame(
1327 frame_xpath, 1325 frame_xpath,
1328 UTF8ToUTF16("window.domAutomationController.setAutomationId(0);")); 1326 UTF8ToUTF16("window.domAutomationController.setAutomationId(0);"));
1329 render_view_host->ExecuteJavascriptInWebFrame( 1327 render_view_host->ExecuteJavascriptInWebFrame(
1330 frame_xpath, script); 1328 frame_xpath, script);
1331 } 1329 }
1332 1330
1333 } // namespace
1334
1335 void TestingAutomationProvider::ExecuteJavascript( 1331 void TestingAutomationProvider::ExecuteJavascript(
1336 int handle, 1332 int handle,
1337 const std::wstring& frame_xpath, 1333 const std::wstring& frame_xpath,
1338 const std::wstring& script, 1334 const std::wstring& script,
1339 IPC::Message* reply_message) { 1335 IPC::Message* reply_message) {
1340 WebContents* web_contents = GetWebContentsForHandle(handle, NULL); 1336 WebContents* web_contents = GetWebContentsForHandle(handle, NULL);
1341 if (!web_contents) { 1337 if (!web_contents) {
1342 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string()); 1338 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string());
1343 Send(reply_message); 1339 Send(reply_message);
1344 return; 1340 return;
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 &TestingAutomationProvider::UpdateExtensionsNow; 2264 &TestingAutomationProvider::UpdateExtensionsNow;
2269 2265
2270 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) 2266 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
2271 handler_map["HeapProfilerDump"] = 2267 handler_map["HeapProfilerDump"] =
2272 &TestingAutomationProvider::HeapProfilerDump; 2268 &TestingAutomationProvider::HeapProfilerDump;
2273 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) 2269 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
2274 #if defined(OS_CHROMEOS) 2270 #if defined(OS_CHROMEOS)
2275 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; 2271 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo;
2276 handler_map["ShowCreateAccountUI"] = 2272 handler_map["ShowCreateAccountUI"] =
2277 &TestingAutomationProvider::ShowCreateAccountUI; 2273 &TestingAutomationProvider::ShowCreateAccountUI;
2274 handler_map["ExecuteJavascriptInOOBEWebUI"] =
2275 &TestingAutomationProvider::ExecuteJavascriptInOOBEWebUI;
2278 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; 2276 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest;
2279 handler_map["Login"] = &TestingAutomationProvider::Login; 2277 handler_map["Login"] = &TestingAutomationProvider::Login;
2280 2278
2281 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen; 2279 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen;
2282 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen; 2280 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen;
2283 handler_map["SignoutInScreenLocker"] = 2281 handler_map["SignoutInScreenLocker"] =
2284 &TestingAutomationProvider::SignoutInScreenLocker; 2282 &TestingAutomationProvider::SignoutInScreenLocker;
2285 2283
2286 handler_map["GetBatteryInfo"] = &TestingAutomationProvider::GetBatteryInfo; 2284 handler_map["GetBatteryInfo"] = &TestingAutomationProvider::GetBatteryInfo;
2287 2285
(...skipping 4750 matching lines...) Expand 10 before | Expand all | Expand 10 after
7038 *browser_handle = browser_tracker_->Add(browser); 7036 *browser_handle = browser_tracker_->Add(browser);
7039 *success = true; 7037 *success = true;
7040 } 7038 }
7041 } 7039 }
7042 } 7040 }
7043 7041
7044 void TestingAutomationProvider::OnRemoveProvider() { 7042 void TestingAutomationProvider::OnRemoveProvider() {
7045 if (g_browser_process) 7043 if (g_browser_process)
7046 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 7044 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
7047 } 7045 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698