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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from Kent; merge. 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "modules/payments/PaymentRequestUpdateEvent.h" 5 #include "modules/payments/PaymentRequestUpdateEvent.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "core/EventTypeNames.h" 10 #include "core/EventTypeNames.h"
11 #include "core/testing/DummyPageHolder.h" 11 #include "core/testing/DummyPageHolder.h"
12 #include "modules/payments/PaymentUpdater.h" 12 #include "modules/payments/PaymentUpdater.h"
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "wtf/OwnPtr.h" 15 #include <memory>
16 16
17 namespace blink { 17 namespace blink {
18 namespace { 18 namespace {
19 19
20 class MockPaymentUpdater : public GarbageCollectedFinalized<MockPaymentUpdater>, public PaymentUpdater { 20 class MockPaymentUpdater : public GarbageCollectedFinalized<MockPaymentUpdater>, public PaymentUpdater {
21 USING_GARBAGE_COLLECTED_MIXIN(MockPaymentUpdater); 21 USING_GARBAGE_COLLECTED_MIXIN(MockPaymentUpdater);
22 WTF_MAKE_NONCOPYABLE(MockPaymentUpdater); 22 WTF_MAKE_NONCOPYABLE(MockPaymentUpdater);
23 23
24 public: 24 public:
25 MockPaymentUpdater() {} 25 MockPaymentUpdater() {}
(...skipping 12 matching lines...) Expand all
38 { 38 {
39 } 39 }
40 40
41 ~PaymentRequestUpdateEventTest() override {} 41 ~PaymentRequestUpdateEventTest() override {}
42 42
43 ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->doc ument().frame()); } 43 ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->doc ument().frame()); }
44 ExecutionContext* getExecutionContext() { return &m_page->document(); } 44 ExecutionContext* getExecutionContext() { return &m_page->document(); }
45 ExceptionState& getExceptionState() { return m_exceptionState; } 45 ExceptionState& getExceptionState() { return m_exceptionState; }
46 46
47 private: 47 private:
48 OwnPtr<DummyPageHolder> m_page; 48 std::unique_ptr<DummyPageHolder> m_page;
49 TrackExceptionState m_exceptionState; 49 TrackExceptionState m_exceptionState;
50 }; 50 };
51 51
52 TEST_F(PaymentRequestUpdateEventTest, OnUpdatePaymentDetailsCalled) 52 TEST_F(PaymentRequestUpdateEventTest, OnUpdatePaymentDetailsCalled)
53 { 53 {
54 ScriptState::Scope scope(getScriptState()); 54 ScriptState::Scope scope(getScriptState());
55 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::create(); 55 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::create();
56 MockPaymentUpdater* updater = new MockPaymentUpdater; 56 MockPaymentUpdater* updater = new MockPaymentUpdater;
57 event->setPaymentDetailsUpdater(updater); 57 event->setPaymentDetailsUpdater(updater);
58 event->setEventPhase(Event::CAPTURING_PHASE); 58 event->setEventPhase(Event::CAPTURING_PHASE);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 ScriptState::Scope scope(getScriptState()); 114 ScriptState::Scope scope(getScriptState());
115 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::create(EventTy peNames::shippingaddresschange); 115 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::create(EventTy peNames::shippingaddresschange);
116 116
117 event->updateWith(getScriptState(), ScriptPromiseResolver::create(getScriptS tate())->promise(), getExceptionState()); 117 event->updateWith(getScriptState(), ScriptPromiseResolver::create(getScriptS tate())->promise(), getExceptionState());
118 118
119 EXPECT_FALSE(getExceptionState().hadException()); 119 EXPECT_FALSE(getExceptionState().hadException());
120 } 120 }
121 121
122 } // namespace 122 } // namespace
123 } // namespace blink 123 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698