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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698