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

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

Issue 2780773004: Reland "PaymentRequest: Introduce PaymentDetailsInit and PaymentDetailsUpdate." (Closed)
Patch Set: Reland "PaymentRequest: Introduce PaymentDetailsInit and PaymentDetailsUpdate." Created 3 years, 8 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/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 EXPECT_FALSE(scope.getExceptionState().hadException()); 121 EXPECT_FALSE(scope.getExceptionState().hadException());
122 } 122 }
123 123
124 TEST(PaymentRequestUpdateEventTest, OnUpdatePaymentDetailsTimeout) { 124 TEST(PaymentRequestUpdateEventTest, OnUpdatePaymentDetailsTimeout) {
125 V8TestingScope scope; 125 V8TestingScope scope;
126 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 126 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
127 makePaymentRequestOriginSecure(scope.document()); 127 makePaymentRequestOriginSecure(scope.document());
128 PaymentRequest* request = PaymentRequest::create( 128 PaymentRequest* request = PaymentRequest::create(
129 scope.getExecutionContext(), buildPaymentMethodDataForTest(), 129 scope.getExecutionContext(), buildPaymentMethodDataForTest(),
130 buildPaymentDetailsForTest(), scope.getExceptionState()); 130 buildPaymentDetailsInitForTest(), scope.getExceptionState());
131 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::create( 131 PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::create(
132 scope.getExecutionContext(), EventTypeNames::shippingaddresschange); 132 scope.getExecutionContext(), EventTypeNames::shippingaddresschange);
133 event->setPaymentDetailsUpdater(request); 133 event->setPaymentDetailsUpdater(request);
134 EXPECT_FALSE(scope.getExceptionState().hadException()); 134 EXPECT_FALSE(scope.getExceptionState().hadException());
135 135
136 String errorMessage; 136 String errorMessage;
137 request->show(scope.getScriptState()) 137 request->show(scope.getScriptState())
138 .then(funcs.expectNoCall(), funcs.expectCall(&errorMessage)); 138 .then(funcs.expectNoCall(), funcs.expectCall(&errorMessage));
139 139
140 event->onUpdateEventTimeoutForTesting(); 140 event->onUpdateEventTimeoutForTesting();
141 141
142 v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate()); 142 v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate());
143 EXPECT_EQ( 143 EXPECT_EQ(
144 "AbortError: Timed out as the page didn't resolve the promise from " 144 "AbortError: Timed out as the page didn't resolve the promise from "
145 "change event", 145 "change event",
146 errorMessage); 146 errorMessage);
147 } 147 }
148 148
149 } // namespace 149 } // namespace
150 } // namespace blink 150 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698