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

Unified Diff: content/shell/test_runner/test_runner.cc

Issue 2923433002: Move ExecuteScript method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Tweaked a comment in WebViewPlugin::WebViewHelper::main_frame [as suggested in CR feedback] Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/mojo_main_runner.cc ('k') | third_party/WebKit/Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/test_runner/test_runner.cc
diff --git a/content/shell/test_runner/test_runner.cc b/content/shell/test_runner/test_runner.cc
index 91c408b94336265131681d1812ae3671af6314a3..416872b6dd72e472d33fe6b80dabde23fe84a790 100644
--- a/content/shell/test_runner/test_runner.cc
+++ b/content/shell/test_runner/test_runner.cc
@@ -2040,7 +2040,13 @@ class WorkItemLoadingScript : public TestRunner::WorkItem {
WorkItemLoadingScript(const std::string& script) : script_(script) {}
bool Run(WebTestDelegate*, WebView* web_view) override {
- web_view->MainFrame()->ExecuteScript(
+ blink::WebFrame* main_frame = web_view->MainFrame();
+ if (!main_frame->IsWebLocalFrame()) {
+ CHECK(false) << "This function cannot be called if the main frame is not "
+ "a local frame.";
+ return false;
+ }
+ main_frame->ToWebLocalFrame()->ExecuteScript(
WebScriptSource(WebString::FromUTF8(script_)));
return true; // FIXME: Did it really start a navigation?
}
@@ -2058,7 +2064,13 @@ class WorkItemNonLoadingScript : public TestRunner::WorkItem {
WorkItemNonLoadingScript(const std::string& script) : script_(script) {}
bool Run(WebTestDelegate*, WebView* web_view) override {
- web_view->MainFrame()->ExecuteScript(
+ blink::WebFrame* main_frame = web_view->MainFrame();
+ if (!main_frame->IsWebLocalFrame()) {
+ CHECK(false) << "This function cannot be called if the main frame is not "
+ "a local frame.";
+ return false;
+ }
+ main_frame->ToWebLocalFrame()->ExecuteScript(
WebScriptSource(WebString::FromUTF8(script_)));
return false;
}
« no previous file with comments | « content/renderer/mojo_main_runner.cc ('k') | third_party/WebKit/Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698