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) |