| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 input->payer_email = "abc@gmail.com"; | 51 input->payer_email = "abc@gmail.com"; |
| 52 input->payer_phone = "0123"; | 52 input->payer_phone = "0123"; |
| 53 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; | 53 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; |
| 54 | 54 |
| 55 PaymentResponse output(std::move(input), completeCallback); | 55 PaymentResponse output(std::move(input), completeCallback); |
| 56 | 56 |
| 57 EXPECT_EQ("foo", output.methodName()); | 57 EXPECT_EQ("foo", output.methodName()); |
| 58 EXPECT_EQ("abc@gmail.com", output.payerEmail()); | 58 EXPECT_EQ("abc@gmail.com", output.payerEmail()); |
| 59 EXPECT_EQ("0123", output.payerPhone()); | 59 EXPECT_EQ("0123", output.payerPhone()); |
| 60 | 60 |
| 61 CurrencyAmount totalAmount; | 61 PaymentCurrencyAmount totalAmount; |
| 62 output.totalAmount(totalAmount); | 62 output.totalAmount(totalAmount); |
| 63 EXPECT_EQ("USD", totalAmount.currency()); | 63 EXPECT_EQ("USD", totalAmount.currency()); |
| 64 EXPECT_EQ("5.00", totalAmount.value()); | 64 EXPECT_EQ("5.00", totalAmount.value()); |
| 65 | 65 |
| 66 ScriptValue details = output.details(scope.getScriptState(), scope.getExcept
ionState()); | 66 ScriptValue details = output.details(scope.getScriptState(), scope.getExcept
ionState()); |
| 67 | 67 |
| 68 ASSERT_FALSE(scope.getExceptionState().hadException()); | 68 ASSERT_FALSE(scope.getExceptionState().hadException()); |
| 69 ASSERT_TRUE(details.v8Value()->IsObject()); | 69 ASSERT_TRUE(details.v8Value()->IsObject()); |
| 70 | 70 |
| 71 ScriptValue transactionId(scope.getScriptState(), details.v8Value().As<v8::O
bject>()->Get(v8String(scope.getScriptState()->isolate(), "transactionId"))); | 71 ScriptValue transactionId(scope.getScriptState(), details.v8Value().As<v8::O
bject>()->Get(v8String(scope.getScriptState()->isolate(), "transactionId"))); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 97 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; | 97 MockPaymentCompleter* completeCallback = new MockPaymentCompleter; |
| 98 PaymentResponse output(std::move(input), completeCallback); | 98 PaymentResponse output(std::move(input), completeCallback); |
| 99 | 99 |
| 100 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), Fail)); | 100 EXPECT_CALL(*completeCallback, complete(scope.getScriptState(), Fail)); |
| 101 | 101 |
| 102 output.complete(scope.getScriptState(), "fail"); | 102 output.complete(scope.getScriptState(), "fail"); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace | 105 } // namespace |
| 106 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |