OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8BindingForTesting_h |
| 6 #define V8BindingForTesting_h |
| 7 |
| 8 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "wtf/Forward.h" |
| 11 |
| 12 #include <v8.h> |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class ScriptStateForTesting : public ScriptState { |
| 17 public: |
| 18 static PassRefPtr<ScriptStateForTesting> create(v8::Handle<v8::Context>, Pas
sRefPtr<DOMWrapperWorld>); |
| 19 virtual ExecutionContext* executionContext() const override; |
| 20 virtual void setExecutionContext(ExecutionContext*) override; |
| 21 private: |
| 22 ScriptStateForTesting(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>); |
| 23 ExecutionContext* m_executionContext; |
| 24 }; |
| 25 |
| 26 class V8TestingScope { |
| 27 public: |
| 28 explicit V8TestingScope(v8::Isolate*); |
| 29 ScriptState* scriptState() const; |
| 30 v8::Isolate* isolate() const; |
| 31 ~V8TestingScope(); |
| 32 |
| 33 private: |
| 34 v8::HandleScope m_handleScope; |
| 35 v8::Context::Scope m_contextScope; |
| 36 RefPtr<ScriptState> m_scriptState; |
| 37 }; |
| 38 |
| 39 } // namespace blink |
| 40 |
| 41 #endif // V8BindingForTesting_h |
OLD | NEW |