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

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

Issue 2967013002: Be explicit about namespace testing to not mix it with blink::testing (Closed)
Patch Set: Dropped mojo parts that need another review. Created 3 years, 5 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 <memory> 7 #include <memory>
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/V8BindingForTesting.h" 10 #include "bindings/core/v8/V8BindingForTesting.h"
(...skipping 30 matching lines...) Expand all
41 scope.GetExecutionContext(), EventTypeNames::shippingaddresschange); 41 scope.GetExecutionContext(), EventTypeNames::shippingaddresschange);
42 MockPaymentUpdater* updater = new MockPaymentUpdater; 42 MockPaymentUpdater* updater = new MockPaymentUpdater;
43 event->SetPaymentDetailsUpdater(updater); 43 event->SetPaymentDetailsUpdater(updater);
44 event->SetEventPhase(Event::kCapturingPhase); 44 event->SetEventPhase(Event::kCapturingPhase);
45 ScriptPromiseResolver* payment_details = 45 ScriptPromiseResolver* payment_details =
46 ScriptPromiseResolver::Create(scope.GetScriptState()); 46 ScriptPromiseResolver::Create(scope.GetScriptState());
47 event->updateWith(scope.GetScriptState(), payment_details->Promise(), 47 event->updateWith(scope.GetScriptState(), payment_details->Promise(),
48 scope.GetExceptionState()); 48 scope.GetExceptionState());
49 EXPECT_FALSE(scope.GetExceptionState().HadException()); 49 EXPECT_FALSE(scope.GetExceptionState().HadException());
50 50
51 EXPECT_CALL(*updater, OnUpdatePaymentDetails(testing::_)); 51 EXPECT_CALL(*updater, OnUpdatePaymentDetails(::testing::_));
52 EXPECT_CALL(*updater, OnUpdatePaymentDetailsFailure(testing::_)).Times(0); 52 EXPECT_CALL(*updater, OnUpdatePaymentDetailsFailure(::testing::_)).Times(0);
53 53
54 payment_details->Resolve("foo"); 54 payment_details->Resolve("foo");
55 } 55 }
56 56
57 TEST(PaymentRequestUpdateEventTest, OnUpdatePaymentDetailsFailureCalled) { 57 TEST(PaymentRequestUpdateEventTest, OnUpdatePaymentDetailsFailureCalled) {
58 V8TestingScope scope; 58 V8TestingScope scope;
59 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::Create( 59 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::Create(
60 scope.GetExecutionContext(), EventTypeNames::shippingaddresschange); 60 scope.GetExecutionContext(), EventTypeNames::shippingaddresschange);
61 MockPaymentUpdater* updater = new MockPaymentUpdater; 61 MockPaymentUpdater* updater = new MockPaymentUpdater;
62 event->SetPaymentDetailsUpdater(updater); 62 event->SetPaymentDetailsUpdater(updater);
63 event->SetEventPhase(Event::kCapturingPhase); 63 event->SetEventPhase(Event::kCapturingPhase);
64 ScriptPromiseResolver* payment_details = 64 ScriptPromiseResolver* payment_details =
65 ScriptPromiseResolver::Create(scope.GetScriptState()); 65 ScriptPromiseResolver::Create(scope.GetScriptState());
66 event->updateWith(scope.GetScriptState(), payment_details->Promise(), 66 event->updateWith(scope.GetScriptState(), payment_details->Promise(),
67 scope.GetExceptionState()); 67 scope.GetExceptionState());
68 EXPECT_FALSE(scope.GetExceptionState().HadException()); 68 EXPECT_FALSE(scope.GetExceptionState().HadException());
69 69
70 EXPECT_CALL(*updater, OnUpdatePaymentDetails(testing::_)).Times(0); 70 EXPECT_CALL(*updater, OnUpdatePaymentDetails(::testing::_)).Times(0);
71 EXPECT_CALL(*updater, OnUpdatePaymentDetailsFailure(testing::_)); 71 EXPECT_CALL(*updater, OnUpdatePaymentDetailsFailure(::testing::_));
72 72
73 payment_details->Reject("oops"); 73 payment_details->Reject("oops");
74 } 74 }
75 75
76 TEST(PaymentRequestUpdateEventTest, CannotUpdateWithoutDispatching) { 76 TEST(PaymentRequestUpdateEventTest, CannotUpdateWithoutDispatching) {
77 V8TestingScope scope; 77 V8TestingScope scope;
78 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::Create( 78 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::Create(
79 scope.GetExecutionContext(), EventTypeNames::shippingaddresschange); 79 scope.GetExecutionContext(), EventTypeNames::shippingaddresschange);
80 event->SetPaymentDetailsUpdater(new MockPaymentUpdater); 80 event->SetPaymentDetailsUpdater(new MockPaymentUpdater);
81 81
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 EXPECT_EQ( 244 EXPECT_EQ(
245 "AbortError: Timed out waiting for a response to a " 245 "AbortError: Timed out waiting for a response to a "
246 "'shippingoptionchange' event", 246 "'shippingoptionchange' event",
247 error_message); 247 error_message);
248 248
249 payment_details->Resolve("foo"); 249 payment_details->Resolve("foo");
250 } 250 }
251 251
252 } // namespace 252 } // namespace
253 } // namespace blink 253 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698