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

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

Issue 2192413002: Timeout if website never completes the transaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Marijn's comments Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentResponse.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/PaymentResponse.h" 5 #include "modules/payments/PaymentResponse.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "bindings/core/v8/ScriptValue.h" 9 #include "bindings/core/v8/ScriptValue.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 TEST(PaymentResponseTest, CompleteCalledWithSuccess) 85 TEST(PaymentResponseTest, CompleteCalledWithSuccess)
86 { 86 {
87 V8TestingScope scope; 87 V8TestingScope scope;
88 mojom::blink::PaymentResponsePtr input = buildPaymentResponseForTest(); 88 mojom::blink::PaymentResponsePtr input = buildPaymentResponseForTest();
89 input->method_name = "foo"; 89 input->method_name = "foo";
90 input->stringified_details = "{\"transactionId\": 123}"; 90 input->stringified_details = "{\"transactionId\": 123}";
91 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; 91 MockPaymentCompleter* completeCallback = new MockPaymentCompleter;
92 PaymentResponse output(std::move(input), completeCallback); 92 PaymentResponse output(std::move(input), completeCallback);
93 93
94 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), Success)); 94 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), PaymentCompl eter::Success));
95 95
96 output.complete(scope.getScriptState(), "success"); 96 output.complete(scope.getScriptState(), "success");
97 } 97 }
98 98
99 TEST(PaymentResponseTest, CompleteCalledWithFailure) 99 TEST(PaymentResponseTest, CompleteCalledWithFailure)
100 { 100 {
101 V8TestingScope scope; 101 V8TestingScope scope;
102 mojom::blink::PaymentResponsePtr input = buildPaymentResponseForTest(); 102 mojom::blink::PaymentResponsePtr input = buildPaymentResponseForTest();
103 input->method_name = "foo"; 103 input->method_name = "foo";
104 input->stringified_details = "{\"transactionId\": 123}"; 104 input->stringified_details = "{\"transactionId\": 123}";
105 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; 105 MockPaymentCompleter* completeCallback = new MockPaymentCompleter;
106 PaymentResponse output(std::move(input), completeCallback); 106 PaymentResponse output(std::move(input), completeCallback);
107 107
108 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), Fail)); 108 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), PaymentCompl eter::Fail));
109 109
110 output.complete(scope.getScriptState(), "fail"); 110 output.complete(scope.getScriptState(), "fail");
111 } 111 }
112 112
113 } // namespace 113 } // namespace
114 } // namespace blink 114 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentResponse.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698