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

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

Issue 2489943003: Revert of [Web Payments] Mojom namespace blink -> payments (Closed)
Patch Set: Created 4 years, 1 month 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 // Tests for PaymentRequest::abort(). 5 // Tests for PaymentRequest::abort().
6 6
7 #include "bindings/core/v8/V8BindingForTesting.h" 7 #include "bindings/core/v8/V8BindingForTesting.h"
8 #include "modules/payments/PaymentRequest.h" 8 #include "modules/payments/PaymentRequest.h"
9 #include "modules/payments/PaymentTestHelper.h" 9 #include "modules/payments/PaymentTestHelper.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 64 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
65 makePaymentRequestOriginSecure(scope.document()); 65 makePaymentRequestOriginSecure(scope.document());
66 PaymentRequest* request = PaymentRequest::create( 66 PaymentRequest* request = PaymentRequest::create(
67 scope.getScriptState(), buildPaymentMethodDataForTest(), 67 scope.getScriptState(), buildPaymentMethodDataForTest(),
68 buildPaymentDetailsForTest(), scope.getExceptionState()); 68 buildPaymentDetailsForTest(), scope.getExceptionState());
69 request->show(scope.getScriptState()); 69 request->show(scope.getScriptState());
70 70
71 request->abort(scope.getScriptState()) 71 request->abort(scope.getScriptState())
72 .then(funcs.expectNoCall(), funcs.expectCall()); 72 .then(funcs.expectNoCall(), funcs.expectCall());
73 73
74 static_cast<payments::mojom::blink::PaymentRequestClient*>(request)->OnAbort( 74 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnAbort(false);
75 false);
76 } 75 }
77 76
78 // After the browser is unable to abort the payment once, the second abort() 77 // After the browser is unable to abort the payment once, the second abort()
79 // call should not be rejected, as it's not a duplicate request anymore. 78 // call should not be rejected, as it's not a duplicate request anymore.
80 TEST(AbortTest, CanAbortAgainAfterFirstAbortRejected) { 79 TEST(AbortTest, CanAbortAgainAfterFirstAbortRejected) {
81 V8TestingScope scope; 80 V8TestingScope scope;
82 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 81 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
83 makePaymentRequestOriginSecure(scope.document()); 82 makePaymentRequestOriginSecure(scope.document());
84 PaymentRequest* request = PaymentRequest::create( 83 PaymentRequest* request = PaymentRequest::create(
85 scope.getScriptState(), buildPaymentMethodDataForTest(), 84 scope.getScriptState(), buildPaymentMethodDataForTest(),
86 buildPaymentDetailsForTest(), scope.getExceptionState()); 85 buildPaymentDetailsForTest(), scope.getExceptionState());
87 request->show(scope.getScriptState()); 86 request->show(scope.getScriptState());
88 request->abort(scope.getScriptState()); 87 request->abort(scope.getScriptState());
89 static_cast<payments::mojom::blink::PaymentRequestClient*>(request)->OnAbort( 88 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnAbort(false);
90 false);
91 89
92 request->abort(scope.getScriptState()) 90 request->abort(scope.getScriptState())
93 .then(funcs.expectNoCall(), funcs.expectNoCall()); 91 .then(funcs.expectNoCall(), funcs.expectNoCall());
94 } 92 }
95 93
96 // If the browser successfully aborts the payment, then the request.show() 94 // If the browser successfully aborts the payment, then the request.show()
97 // promise should be rejected, and request.abort() promise should be resolved. 95 // promise should be rejected, and request.abort() promise should be resolved.
98 TEST(AbortTest, SuccessfulAbortShouldRejectShowPromiseAndResolveAbortPromise) { 96 TEST(AbortTest, SuccessfulAbortShouldRejectShowPromiseAndResolveAbortPromise) {
99 V8TestingScope scope; 97 V8TestingScope scope;
100 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 98 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
101 makePaymentRequestOriginSecure(scope.document()); 99 makePaymentRequestOriginSecure(scope.document());
102 PaymentRequest* request = PaymentRequest::create( 100 PaymentRequest* request = PaymentRequest::create(
103 scope.getScriptState(), buildPaymentMethodDataForTest(), 101 scope.getScriptState(), buildPaymentMethodDataForTest(),
104 buildPaymentDetailsForTest(), scope.getExceptionState()); 102 buildPaymentDetailsForTest(), scope.getExceptionState());
105 103
106 request->show(scope.getScriptState()) 104 request->show(scope.getScriptState())
107 .then(funcs.expectNoCall(), funcs.expectCall()); 105 .then(funcs.expectNoCall(), funcs.expectCall());
108 request->abort(scope.getScriptState()) 106 request->abort(scope.getScriptState())
109 .then(funcs.expectCall(), funcs.expectNoCall()); 107 .then(funcs.expectCall(), funcs.expectNoCall());
110 108
111 static_cast<payments::mojom::blink::PaymentRequestClient*>(request)->OnAbort( 109 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnAbort(true);
112 true);
113 } 110 }
114 111
115 } // namespace 112 } // namespace
116 } // namespace blink 113 } // namespace blink
OLDNEW
« no previous file with comments | « content/public/app/mojo/content_browser_manifest.json ('k') | third_party/WebKit/Source/modules/payments/CompleteTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698