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

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: Ready for review. Created 8 years, 8 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 handler_map["WaitUntilNavigationCompletes"] = 2161 handler_map["WaitUntilNavigationCompletes"] =
2166 &TestingAutomationProvider::WaitUntilNavigationCompletes; 2162 &TestingAutomationProvider::WaitUntilNavigationCompletes;
2167 handler_map["GetLocalStatePrefsInfo"] = 2163 handler_map["GetLocalStatePrefsInfo"] =
2168 &TestingAutomationProvider::GetLocalStatePrefsInfo; 2164 &TestingAutomationProvider::GetLocalStatePrefsInfo;
2169 handler_map["SetLocalStatePrefs"] = 2165 handler_map["SetLocalStatePrefs"] =
2170 &TestingAutomationProvider::SetLocalStatePrefs; 2166 &TestingAutomationProvider::SetLocalStatePrefs;
2171 handler_map["GetPrefsInfo"] = &TestingAutomationProvider::GetPrefsInfo; 2167 handler_map["GetPrefsInfo"] = &TestingAutomationProvider::GetPrefsInfo;
2172 handler_map["SetPrefs"] = &TestingAutomationProvider::SetPrefs; 2168 handler_map["SetPrefs"] = &TestingAutomationProvider::SetPrefs;
2173 handler_map["ExecuteJavascript"] = 2169 handler_map["ExecuteJavascript"] =
2174 &TestingAutomationProvider::ExecuteJavascriptJSON; 2170 &TestingAutomationProvider::ExecuteJavascriptJSON;
2171 handler_map["ExecuteJavascriptInLogin"] =
Nirnimesh 2012/04/27 22:46:38 move to OS_CHROMEOS section below
craigdh 2012/04/27 23:29:50 Done.
2172 &TestingAutomationProvider::ExecuteJavascriptInLogin;
2175 handler_map["AddDomEventObserver"] = 2173 handler_map["AddDomEventObserver"] =
2176 &TestingAutomationProvider::AddDomEventObserver; 2174 &TestingAutomationProvider::AddDomEventObserver;
2177 handler_map["RemoveEventObserver"] = 2175 handler_map["RemoveEventObserver"] =
2178 &TestingAutomationProvider::RemoveEventObserver; 2176 &TestingAutomationProvider::RemoveEventObserver;
2179 handler_map["GetNextEvent"] = 2177 handler_map["GetNextEvent"] =
2180 &TestingAutomationProvider::GetNextEvent; 2178 &TestingAutomationProvider::GetNextEvent;
2181 handler_map["ClearEventQueue"] = 2179 handler_map["ClearEventQueue"] =
2182 &TestingAutomationProvider::ClearEventQueue; 2180 &TestingAutomationProvider::ClearEventQueue;
2183 handler_map["ExecuteJavascriptInRenderView"] = 2181 handler_map["ExecuteJavascriptInRenderView"] =
2184 &TestingAutomationProvider::ExecuteJavascriptInRenderView; 2182 &TestingAutomationProvider::ExecuteJavascriptInRenderView;
(...skipping 4853 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