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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.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/ScriptPromiseResolver.h" 5 #include "bindings/core/v8/ScriptPromiseResolver.h"
6 6
7 #include "bindings/core/v8/ScriptFunction.h" 7 #include "bindings/core/v8/ScriptFunction.h"
8 #include "bindings/core/v8/ScriptValue.h" 8 #include "bindings/core/v8/ScriptValue.h"
9 #include "bindings/core/v8/V8Binding.h" 9 #include "bindings/core/v8/V8Binding.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
11 #include "core/dom/Document.h" 11 #include "core/dom/Document.h"
12 #include "core/testing/DummyPageHolder.h" 12 #include "core/testing/DummyPageHolder.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include <memory>
15 #include <v8.h> 14 #include <v8.h>
16 15
17 namespace blink { 16 namespace blink {
18 17
19 namespace { 18 namespace {
20 19
21 void callback(const v8::FunctionCallbackInfo<v8::Value>& info) { } 20 void callback(const v8::FunctionCallbackInfo<v8::Value>& info) { }
22 21
23 class Function : public ScriptFunction { 22 class Function : public ScriptFunction {
24 public: 23 public:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 { 55 {
57 ScriptState::Scope scope(getScriptState()); 56 ScriptState::Scope scope(getScriptState());
58 // FIXME: We put this statement here to clear an exception from the 57 // FIXME: We put this statement here to clear an exception from the
59 // isolate. 58 // isolate.
60 createClosure(callback, v8::Undefined(isolate()), isolate()); 59 createClosure(callback, v8::Undefined(isolate()), isolate());
61 60
62 // Execute all pending microtasks 61 // Execute all pending microtasks
63 v8::MicrotasksScope::PerformCheckpoint(isolate()); 62 v8::MicrotasksScope::PerformCheckpoint(isolate());
64 } 63 }
65 64
66 std::unique_ptr<DummyPageHolder> m_pageHolder; 65 OwnPtr<DummyPageHolder> m_pageHolder;
67 ScriptState* getScriptState() const { return ScriptState::forMainWorld(&m_pa geHolder->frame()); } 66 ScriptState* getScriptState() const { return ScriptState::forMainWorld(&m_pa geHolder->frame()); }
68 ExecutionContext* getExecutionContext() const { return &m_pageHolder->docume nt(); } 67 ExecutionContext* getExecutionContext() const { return &m_pageHolder->docume nt(); }
69 v8::Isolate* isolate() const { return getScriptState()->isolate(); } 68 v8::Isolate* isolate() const { return getScriptState()->isolate(); }
70 }; 69 };
71 70
72 TEST_F(ScriptPromiseResolverTest, construct) 71 TEST_F(ScriptPromiseResolverTest, construct)
73 { 72 {
74 ASSERT_FALSE(getExecutionContext()->activeDOMObjectsAreStopped()); 73 ASSERT_FALSE(getExecutionContext()->activeDOMObjectsAreStopped());
75 ScriptState::Scope scope(getScriptState()); 74 ScriptState::Scope scope(getScriptState());
76 ScriptPromiseResolver::create(getScriptState()); 75 ScriptPromiseResolver::create(getScriptState());
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 resolver->reject(); 346 resolver->reject();
348 v8::MicrotasksScope::PerformCheckpoint(isolate()); 347 v8::MicrotasksScope::PerformCheckpoint(isolate());
349 348
350 EXPECT_EQ(String(), onFulfilled); 349 EXPECT_EQ(String(), onFulfilled);
351 EXPECT_EQ("undefined", onRejected); 350 EXPECT_EQ("undefined", onRejected);
352 } 351 }
353 352
354 } // namespace 353 } // namespace
355 354
356 } // namespace blink 355 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698