OLD | NEW |
---|---|
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 29 matching lines...) Expand all Loading... | |
40 ScriptPromise m_dummyPromise; | 40 ScriptPromise m_dummyPromise; |
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->stringified_details = "{\"transactionId\": 123}"; | 48 input->stringified_details = "{\"transactionId\": 123}"; |
49 input->shipping_option = "standardShippingOption"; | 49 input->shipping_option = "standardShippingOption"; |
50 input->payer_name = "Torvalds"; | |
please use gerrit instead
2016/09/19 08:06:31
Ditto about real people names.
zino
2016/09/19 13:26:08
Done.
| |
50 input->payer_email = "abc@gmail.com"; | 51 input->payer_email = "abc@gmail.com"; |
51 input->payer_phone = "0123"; | 52 input->payer_phone = "0123"; |
52 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; | 53 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; |
53 | 54 |
54 PaymentResponse output(std::move(input), completeCallback); | 55 PaymentResponse output(std::move(input), completeCallback); |
55 | 56 |
56 EXPECT_EQ("foo", output.methodName()); | 57 EXPECT_EQ("foo", output.methodName()); |
57 EXPECT_EQ("standardShippingOption", output.shippingOption()); | 58 EXPECT_EQ("standardShippingOption", output.shippingOption()); |
59 EXPECT_EQ("Torvalds", output.payerName()); | |
58 EXPECT_EQ("abc@gmail.com", output.payerEmail()); | 60 EXPECT_EQ("abc@gmail.com", output.payerEmail()); |
59 EXPECT_EQ("0123", output.payerPhone()); | 61 EXPECT_EQ("0123", output.payerPhone()); |
60 | 62 |
61 ScriptValue details = output.details(scope.getScriptState(), scope.getExcept ionState()); | 63 ScriptValue details = output.details(scope.getScriptState(), scope.getExcept ionState()); |
62 | 64 |
63 ASSERT_FALSE(scope.getExceptionState().hadException()); | 65 ASSERT_FALSE(scope.getExceptionState().hadException()); |
64 ASSERT_TRUE(details.v8Value()->IsObject()); | 66 ASSERT_TRUE(details.v8Value()->IsObject()); |
65 | 67 |
66 ScriptValue transactionId(scope.getScriptState(), details.v8Value().As<v8::O bject>()->Get(v8String(scope.getScriptState()->isolate(), "transactionId"))); | 68 ScriptValue transactionId(scope.getScriptState(), details.v8Value().As<v8::O bject>()->Get(v8String(scope.getScriptState()->isolate(), "transactionId"))); |
67 | 69 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; | 107 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; |
106 PaymentResponse output(std::move(input), completeCallback); | 108 PaymentResponse output(std::move(input), completeCallback); |
107 | 109 |
108 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), PaymentCompl eter::Fail)); | 110 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), PaymentCompl eter::Fail)); |
109 | 111 |
110 output.complete(scope.getScriptState(), "fail"); | 112 output.complete(scope.getScriptState(), "fail"); |
111 } | 113 } |
112 | 114 |
113 } // namespace | 115 } // namespace |
114 } // namespace blink | 116 } // namespace blink |
OLD | NEW |