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

Unified Diff: content/public/browser/render_frame_host.h

Issue 1123783002: Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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
Index: content/public/browser/render_frame_host.h
diff --git a/content/public/browser/render_frame_host.h b/content/public/browser/render_frame_host.h
index 3097ff11616af0f9efcc8b5401c0f1d624d3d948..e47441df9aebe577a4ae10dbc6e3e0dbf606797c 100644
--- a/content/public/browser/render_frame_host.h
+++ b/content/public/browser/render_frame_host.h
@@ -35,6 +35,11 @@ class CONTENT_EXPORT RenderFrameHost : public IPC::Listener,
// Returns nullptr if the IDs do not correspond to a live RenderFrameHost.
static RenderFrameHost* FromID(int render_process_id, int render_frame_id);
+ // Globally allows for injecting JavaScript into the main world. This feature
+ // is present only to support Android WebView and must not be used in other
+ // configurations.
+ static void AllowInjectingJavaScriptForAndroidWebView();
+
~RenderFrameHost() override {}
// Returns the route id for this frame.
@@ -74,17 +79,24 @@ class CONTENT_EXPORT RenderFrameHost : public IPC::Listener,
// Runs some JavaScript in this frame's context. If a callback is provided, it
// will be used to return the result, when the result is available.
+ // This API can only be called on chrome:// or chrome-devtools:// URLs.
typedef base::Callback<void(const base::Value*)> JavaScriptResultCallback;
virtual void ExecuteJavaScript(const base::string16& javascript) = 0;
virtual void ExecuteJavaScript(const base::string16& javascript,
const JavaScriptResultCallback& callback) = 0;
+
+ // Runs some JavaScript in an isolated world of top of this frame's context.
virtual void ExecuteJavaScriptInIsolatedWorld(
const base::string16& javascript,
const JavaScriptResultCallback& callback,
int world_id) = 0;
- // ONLY FOR TESTS: Same as above but adds a fake UserGestureIndicator around
- // execution. (crbug.com/408426)
+ // ONLY FOR TESTS: Same as above but without restrictions. Optionally, adds a
+ // fake UserGestureIndicator around execution. (crbug.com/408426)
+ virtual void ExecuteJavaScriptForTests(const base::string16& javascript) = 0;
+ virtual void ExecuteJavaScriptForTests(
+ const base::string16& javascript,
+ const JavaScriptResultCallback& callback) = 0;
virtual void ExecuteJavaScriptWithUserGestureForTests(
const base::string16& javascript) = 0;

Powered by Google App Engine
This is Rietveld 408576698