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 "bindings/core/v8/ScriptPromiseProperty.h" | 5 #include "bindings/core/v8/ScriptPromiseProperty.h" |
6 | 6 |
7 #include "bindings/core/v8/DOMWrapperWorld.h" | 7 #include "bindings/core/v8/DOMWrapperWorld.h" |
8 #include "bindings/core/v8/ScriptFunction.h" | 8 #include "bindings/core/v8/ScriptFunction.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
11 #include "bindings/core/v8/ScriptValue.h" | 11 #include "bindings/core/v8/ScriptValue.h" |
12 #include "bindings/core/v8/V8Binding.h" | 12 #include "bindings/core/v8/V8Binding.h" |
13 #include "bindings/core/v8/V8BindingForTesting.h" | 13 #include "bindings/core/v8/V8BindingForTesting.h" |
14 #include "bindings/core/v8/V8GCController.h" | 14 #include "bindings/core/v8/V8GCController.h" |
15 #include "core/dom/Document.h" | 15 #include "core/dom/Document.h" |
16 #include "core/testing/DummyPageHolder.h" | 16 #include "core/testing/DummyPageHolder.h" |
17 #include "core/testing/GCObservation.h" | 17 #include "core/testing/GCObservation.h" |
18 #include "core/testing/GarbageCollectedScriptWrappable.h" | 18 #include "core/testing/GarbageCollectedScriptWrappable.h" |
19 #include "platform/heap/Handle.h" | 19 #include "platform/heap/Handle.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "wtf/OwnPtr.h" |
| 22 #include "wtf/PassOwnPtr.h" |
21 #include "wtf/PassRefPtr.h" | 23 #include "wtf/PassRefPtr.h" |
22 #include "wtf/RefPtr.h" | 24 #include "wtf/RefPtr.h" |
23 #include <memory> | |
24 #include <v8.h> | 25 #include <v8.h> |
25 | 26 |
26 using namespace blink; | 27 using namespace blink; |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 class NotReached : public ScriptFunction { | 31 class NotReached : public ScriptFunction { |
31 public: | 32 public: |
32 static v8::Local<v8::Function> createFunction(ScriptState* scriptState) | 33 static v8::Local<v8::Function> createFunction(ScriptState* scriptState) |
33 { | 34 { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 template <typename T> | 137 template <typename T> |
137 ScriptValue wrap(DOMWrapperWorld& world, const T& value) | 138 ScriptValue wrap(DOMWrapperWorld& world, const T& value) |
138 { | 139 { |
139 v8::HandleScope handleScope(isolate()); | 140 v8::HandleScope handleScope(isolate()); |
140 ScriptState* scriptState = ScriptState::from(toV8Context(&document(), wo
rld)); | 141 ScriptState* scriptState = ScriptState::from(toV8Context(&document(), wo
rld)); |
141 ScriptState::Scope scope(scriptState); | 142 ScriptState::Scope scope(scriptState); |
142 return ScriptValue(scriptState, toV8(value, scriptState->context()->Glob
al(), isolate())); | 143 return ScriptValue(scriptState, toV8(value, scriptState->context()->Glob
al(), isolate())); |
143 } | 144 } |
144 | 145 |
145 private: | 146 private: |
146 std::unique_ptr<DummyPageHolder> m_page; | 147 OwnPtr<DummyPageHolder> m_page; |
147 RefPtr<ScriptState> m_otherScriptState; | 148 RefPtr<ScriptState> m_otherScriptState; |
148 }; | 149 }; |
149 | 150 |
150 // This is the main test class. | 151 // This is the main test class. |
151 // If you want to examine a testcase independent of holder types, place the | 152 // If you want to examine a testcase independent of holder types, place the |
152 // test on this class. | 153 // test on this class. |
153 class ScriptPromisePropertyGarbageCollectedTest : public ScriptPromisePropertyTe
stBase, public ::testing::Test { | 154 class ScriptPromisePropertyGarbageCollectedTest : public ScriptPromisePropertyTe
stBase, public ::testing::Test { |
154 public: | 155 public: |
155 typedef GarbageCollectedHolder::Property Property; | 156 typedef GarbageCollectedHolder::Property Property; |
156 | 157 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 { | 431 { |
431 test(String("hello"), "hello", __FILE__, __LINE__); | 432 test(String("hello"), "hello", __FILE__, __LINE__); |
432 } | 433 } |
433 | 434 |
434 TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest, ResolveWithI
nteger) | 435 TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest, ResolveWithI
nteger) |
435 { | 436 { |
436 test(-1, "-1", __FILE__, __LINE__); | 437 test(-1, "-1", __FILE__, __LINE__); |
437 } | 438 } |
438 | 439 |
439 } // namespace | 440 } // namespace |
OLD | NEW |