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

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

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
« no previous file with comments | « Source/bindings/core/v8/V8BindingForTesting.h ('k') | Source/bindings/core/v8/V8BindingTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8BindingForTesting.cpp
diff --git a/Source/bindings/core/v8/V8TestingScope.cpp b/Source/bindings/core/v8/V8BindingForTesting.cpp
similarity index 50%
rename from Source/bindings/core/v8/V8TestingScope.cpp
rename to Source/bindings/core/v8/V8BindingForTesting.cpp
index 3cb08ed8e7a57d89fcf043f4dd9c3effbba18db3..15831d785cf1536cd66abd0065e9dffed1a12b7c 100644
--- a/Source/bindings/core/v8/V8TestingScope.cpp
+++ b/Source/bindings/core/v8/V8BindingForTesting.cpp
@@ -3,12 +3,36 @@
// found in the LICENSE file.
#include "config.h"
-#include "bindings/core/v8/V8TestingScope.h"
+#include "bindings/core/v8/V8BindingForTesting.h"
#include "bindings/core/v8/DOMWrapperWorld.h"
namespace blink {
+PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world)
+{
+ RefPtr<ScriptStateForTesting> scriptState = adoptRef(new ScriptStateForTesting(context, world));
+ // This ref() is for keeping this ScriptState alive as long as the v8::Context is alive.
+ // This is deref()ed in the weak callback of the v8::Context.
Nico 2015/08/29 21:42:48 This seems to not work, see http://build.chromium.
haraken 2015/08/30 01:26:07 I think this is an issue of ScriptPromisePropertyT
+ scriptState->ref();
+ return scriptState;
+}
+
+ScriptStateForTesting::ScriptStateForTesting(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world)
+ : ScriptState(context, world)
+{
+}
+
+ExecutionContext* ScriptStateForTesting::executionContext() const
+{
+ return m_executionContext;
+}
+
+void ScriptStateForTesting::setExecutionContext(ExecutionContext* executionContext)
+{
+ m_executionContext = executionContext;
+}
+
V8TestingScope::V8TestingScope(v8::Isolate* isolate)
: m_handleScope(isolate)
, m_contextScope(v8::Context::New(isolate))
« no previous file with comments | « Source/bindings/core/v8/V8BindingForTesting.h ('k') | Source/bindings/core/v8/V8BindingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698