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

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

Issue 2038423002: Adding support for phone and email. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding support for phone and email. 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/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 30 matching lines...) Expand all
41 }; 41 };
42 42
43 TEST(PaymentResponseTest, DataCopiedOver) 43 TEST(PaymentResponseTest, DataCopiedOver)
44 { 44 {
45 V8TestingScope scope; 45 V8TestingScope scope;
46 mojom::blink::PaymentResponsePtr input = buildPaymentResponseForTest(); 46 mojom::blink::PaymentResponsePtr input = buildPaymentResponseForTest();
47 input->method_name = "foo"; 47 input->method_name = "foo";
48 input->total_amount->currency = "USD"; 48 input->total_amount->currency = "USD";
49 input->total_amount->value = "5.00"; 49 input->total_amount->value = "5.00";
50 input->stringified_details = "{\"transactionId\": 123}"; 50 input->stringified_details = "{\"transactionId\": 123}";
51 input->payer_email = "abc@gmail.com";
52 input->payer_phone = "0123";
51 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; 53 MockPaymentCompleter* completeCallback = new MockPaymentCompleter;
52 54
53 PaymentResponse output(std::move(input), completeCallback); 55 PaymentResponse output(std::move(input), completeCallback);
54 56
55 EXPECT_EQ("foo", output.methodName()); 57 EXPECT_EQ("foo", output.methodName());
58 EXPECT_EQ("abc@gmail.com", output.payerEmail());
59 EXPECT_EQ("0123", output.payerPhone());
56 60
57 CurrencyAmount totalAmount; 61 CurrencyAmount totalAmount;
58 output.totalAmount(totalAmount); 62 output.totalAmount(totalAmount);
59 EXPECT_EQ("USD", totalAmount.currency()); 63 EXPECT_EQ("USD", totalAmount.currency());
60 EXPECT_EQ("5.00", totalAmount.value()); 64 EXPECT_EQ("5.00", totalAmount.value());
61 65
62 ScriptValue details = output.details(scope.getScriptState(), scope.getExcept ionState()); 66 ScriptValue details = output.details(scope.getScriptState(), scope.getExcept ionState());
63 67
64 ASSERT_FALSE(scope.getExceptionState().hadException()); 68 ASSERT_FALSE(scope.getExceptionState().hadException());
65 ASSERT_TRUE(details.v8Value()->IsObject()); 69 ASSERT_TRUE(details.v8Value()->IsObject());
(...skipping 27 matching lines...) Expand all
93 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; 97 MockPaymentCompleter* completeCallback = new MockPaymentCompleter;
94 PaymentResponse output(std::move(input), completeCallback); 98 PaymentResponse output(std::move(input), completeCallback);
95 99
96 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), false)); 100 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), false));
97 101
98 output.complete(scope.getScriptState(), false); 102 output.complete(scope.getScriptState(), false);
99 } 103 }
100 104
101 } // namespace 105 } // namespace
102 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698