OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/renderer/test_runner/event_sender.h" | 5 #include "content/shell/renderer/test_runner/event_sender.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "content/shell/renderer/test_runner/MockSpellCheck.h" | 10 #include "content/shell/renderer/test_runner/MockSpellCheck.h" |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 v8::Isolate* isolate = blink::mainThreadIsolate(); | 429 v8::Isolate* isolate = blink::mainThreadIsolate(); |
430 v8::HandleScope handle_scope(isolate); | 430 v8::HandleScope handle_scope(isolate); |
431 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); | 431 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); |
432 if (context.IsEmpty()) | 432 if (context.IsEmpty()) |
433 return; | 433 return; |
434 | 434 |
435 v8::Context::Scope context_scope(context); | 435 v8::Context::Scope context_scope(context); |
436 | 436 |
437 gin::Handle<EventSenderBindings> bindings = | 437 gin::Handle<EventSenderBindings> bindings = |
438 gin::CreateHandle(isolate, new EventSenderBindings(sender)); | 438 gin::CreateHandle(isolate, new EventSenderBindings(sender)); |
| 439 if (bindings.IsEmpty()) |
| 440 return; |
439 v8::Handle<v8::Object> global = context->Global(); | 441 v8::Handle<v8::Object> global = context->Global(); |
440 global->Set(gin::StringToV8(isolate, "eventSender"), bindings.ToV8()); | 442 global->Set(gin::StringToV8(isolate, "eventSender"), bindings.ToV8()); |
441 } | 443 } |
442 | 444 |
443 gin::ObjectTemplateBuilder | 445 gin::ObjectTemplateBuilder |
444 EventSenderBindings::GetObjectTemplateBuilder(v8::Isolate* isolate) { | 446 EventSenderBindings::GetObjectTemplateBuilder(v8::Isolate* isolate) { |
445 return gin::Wrappable<EventSenderBindings>::GetObjectTemplateBuilder(isolate) | 447 return gin::Wrappable<EventSenderBindings>::GetObjectTemplateBuilder(isolate) |
446 .SetMethod("enableDOMUIEventLogging", | 448 .SetMethod("enableDOMUIEventLogging", |
447 &EventSenderBindings::EnableDOMUIEventLogging) | 449 &EventSenderBindings::EnableDOMUIEventLogging) |
448 .SetMethod("fireKeyboardEventsToElement", | 450 .SetMethod("fireKeyboardEventsToElement", |
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 } | 2149 } |
2148 default: | 2150 default: |
2149 NOTREACHED(); | 2151 NOTREACHED(); |
2150 } | 2152 } |
2151 } | 2153 } |
2152 | 2154 |
2153 replaying_saved_events_ = false; | 2155 replaying_saved_events_ = false; |
2154 } | 2156 } |
2155 | 2157 |
2156 } // namespace content | 2158 } // namespace content |
OLD | NEW |