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

Unified Diff: Source/bindings/core/v8/V8BindingForTesting.h

Issue 1013413002: [bindings] Refactor ScriptStateForTesting, V8TestingScope into V8BindingForTesting.h/cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Combined all testing files into one! Created 5 years, 9 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
Index: Source/bindings/core/v8/V8BindingForTesting.h
diff --git a/Source/bindings/core/v8/V8BindingForTesting.h b/Source/bindings/core/v8/V8BindingForTesting.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f35b52efd31e00fc75e6df02fb8cd2438722545
--- /dev/null
+++ b/Source/bindings/core/v8/V8BindingForTesting.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8BindingForTesting_h
+#define V8BindingForTesting_h
+
+#include "bindings/core/v8/DOMWrapperWorld.h"
+#include "bindings/core/v8/ScriptState.h"
+#include "wtf/Forward.h"
+
+#include <v8.h>
+
+namespace blink {
+
+class ScriptStateForTesting : public ScriptState {
+public:
+ static PassRefPtr<ScriptStateForTesting> create(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>);
+ virtual ExecutionContext* executionContext() const override;
+ virtual void setExecutionContext(ExecutionContext*) override;
+private:
+ ScriptStateForTesting(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>);
+ ExecutionContext* m_executionContext;
+};
+
+class V8TestingScope {
+public:
+ explicit V8TestingScope(v8::Isolate*);
+ ScriptState* scriptState() const;
+ v8::Isolate* isolate() const;
+ ~V8TestingScope();
+
+private:
+ v8::HandleScope m_handleScope;
+ v8::Context::Scope m_contextScope;
+ RefPtr<ScriptState> m_scriptState;
+};
+
+} // namespace blink
+
+#endif // V8BindingForTesting_h

Powered by Google App Engine
This is Rietveld 408576698