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

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

Issue 1141993002: Inline binding_helpers.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/renderer/ipc_echo.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/test_runner.cc
diff --git a/content/shell/renderer/test_runner/test_runner.cc b/content/shell/renderer/test_runner/test_runner.cc
index 6291b66ac7f983fef461b082898442f28a07b078..c40f2f60942aa2f6ee691385ef2a1b842cc0ac1c 100644
--- a/content/shell/renderer/test_runner/test_runner.cc
+++ b/content/shell/renderer/test_runner/test_runner.cc
@@ -8,7 +8,6 @@
#include "base/logging.h"
#include "content/shell/common/test_runner/test_preferences.h"
-#include "content/shell/renderer/binding_helpers.h"
#include "content/shell/renderer/test_runner/mock_credential_manager_client.h"
#include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h"
#include "content/shell/renderer/test_runner/test_interfaces.h"
@@ -327,11 +326,27 @@ gin::WrapperInfo TestRunnerBindings::kWrapperInfo = {
// static
void TestRunnerBindings::Install(base::WeakPtr<TestRunner> runner,
WebFrame* frame) {
+ v8::Isolate* isolate = blink::mainThreadIsolate();
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = frame->mainWorldScriptContext();
+ if (context.IsEmpty())
+ return;
+
+ v8::Context::Scope context_scope(context);
+
+ TestRunnerBindings* wrapped = new TestRunnerBindings(runner);
+ gin::Handle<TestRunnerBindings> bindings =
+ gin::CreateHandle(isolate, wrapped);
+ if (bindings.IsEmpty())
+ return;
+ v8::Local<v8::Object> global = context->Global();
+ v8::Local<v8::Value> v8_bindings = bindings.ToV8();
+
std::vector<std::string> names;
names.push_back("testRunner");
names.push_back("layoutTestController");
- return InstallAsWindowProperties(
- new TestRunnerBindings(runner), frame, names);
+ for (size_t i = 0; i < names.size(); ++i)
+ global->Set(gin::StringToV8(isolate, names[i].c_str()), v8_bindings);
}
TestRunnerBindings::TestRunnerBindings(base::WeakPtr<TestRunner> runner)
« no previous file with comments | « content/shell/renderer/ipc_echo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698