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