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

Unified Diff: content/public/test/browser_test_utils.cc

Issue 1336433002: Revert of Expose distiller functions to JavaScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-content
Patch Set: Created 5 years, 3 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/public/test/browser_test_utils.h ('k') | content/renderer/dom_automation_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_utils.cc
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index d2600bbf3164da979295d2f8b9134621aa118819..214b2fd61d678cca452e21f5e3fcde487f0bc5a8 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -163,43 +163,6 @@
return true;
}
-// Specifying a prototype so that we can add the WARN_UNUSED_RESULT attribute.
-bool ExecuteScriptInIsolatedWorldHelper(RenderFrameHost* render_frame_host,
- const int world_id,
- const std::string& original_script,
- scoped_ptr<base::Value>* result)
- WARN_UNUSED_RESULT;
-
-bool ExecuteScriptInIsolatedWorldHelper(RenderFrameHost* render_frame_host,
- const int world_id,
- const std::string& original_script,
- scoped_ptr<base::Value>* result) {
- std::string script =
- "window.domAutomationController.setAutomationId(0);" + original_script;
- DOMOperationObserver dom_op_observer(render_frame_host->GetRenderViewHost());
- render_frame_host->ExecuteJavaScriptInIsolatedWorld(
- base::UTF8ToUTF16(script),
- content::RenderFrameHost::JavaScriptResultCallback(), world_id);
- std::string json;
- if (!dom_op_observer.WaitAndGetResponse(&json)) {
- DLOG(ERROR) << "Cannot communicate with DOMOperationObserver.";
- return false;
- }
-
- // Nothing more to do for callers that ignore the returned JS value.
- if (!result)
- return true;
-
- base::JSONReader reader(base::JSON_ALLOW_TRAILING_COMMAS);
- *result = reader.ReadToValue(json);
- if (!*result) {
- DLOG(ERROR) << reader.GetErrorMessage();
- return false;
- }
-
- return true;
-}
-
void BuildSimpleWebKeyEvent(blink::WebInputEvent::Type type,
ui::KeyboardCode key_code,
int native_key_code,
@@ -615,22 +578,6 @@
DCHECK(result);
scoped_ptr<base::Value> value;
if (!ExecuteScriptHelper(adapter.render_frame_host(), script, &value) ||
- !value.get()) {
- return false;
- }
-
- return value->GetAsBoolean(result);
-}
-
-bool ExecuteScriptInIsolatedWorldAndExtractBool(
- const ToRenderFrameHost& adapter,
- const int world_id,
- const std::string& script,
- bool* result) {
- DCHECK(result);
- scoped_ptr<base::Value> value;
- if (!ExecuteScriptInIsolatedWorldHelper(adapter.render_frame_host(), world_id,
- script, &value) ||
!value.get()) {
return false;
}
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | content/renderer/dom_automation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698