| Index: third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
|
| diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
|
| index 5c93ec672f06aaed3b52fbe945496dfabf380d10..eb99da3b100e61ed9dc166a9271c3269df250ad7 100644
|
| --- a/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
|
| +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
|
| @@ -35,7 +35,6 @@ TEST(PaymentRequestTest, NoExceptionWithValidData)
|
| EXPECT_FALSE(scope.getExceptionState().hadException());
|
| }
|
|
|
| -
|
| TEST(PaymentRequestTest, SupportedMethodListRequired)
|
| {
|
| V8TestingScope scope;
|
| @@ -56,6 +55,16 @@ TEST(PaymentRequestTest, TotalRequired)
|
| EXPECT_EQ(V8TypeError, scope.getExceptionState().code());
|
| }
|
|
|
| +TEST(PaymentRequestTest, ErrorMsgMustBeEmptyInConstrctor)
|
| +{
|
| + V8TestingScope scope;
|
| + makePaymentRequestOriginSecure(scope.document());
|
| + PaymentRequest::create(scope.getScriptState(), buildPaymentMethodDataForTest(), buildPaymentDetailsErrorMsgForTest("This is an error message."), scope.getExceptionState());
|
| +
|
| + EXPECT_TRUE(scope.getExceptionState().hadException());
|
| + EXPECT_EQ(V8TypeError, scope.getExceptionState().code());
|
| +}
|
| +
|
| TEST(PaymentRequestTest, NullShippingOptionWhenNoOptionsAvailable)
|
| {
|
| V8TestingScope scope;
|
| @@ -466,5 +475,21 @@ TEST(PaymentRequestTest, UseTheSelectedShippingOptionFromPaymentDetailsUpdate)
|
| EXPECT_EQ("fast", request->shippingOption());
|
| }
|
|
|
| +TEST(PaymentRequestTest, NoExceptionWithErrorMessageInUpdate)
|
| +{
|
| + V8TestingScope scope;
|
| + PaymentRequestMockFunctionScope funcs(scope.getScriptState());
|
| + makePaymentRequestOriginSecure(scope.document());
|
| + PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), buildPaymentMethodDataForTest(), buildPaymentDetailsForTest(), scope.getExceptionState());
|
| + EXPECT_FALSE(scope.getExceptionState().hadException());
|
| +
|
| + request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expectNoCall());
|
| + String detailWithErrorMsg = "{\"total\": {\"label\": \"Total\", \"amount\": {\"currency\": \"USD\", \"value\": \"5.00\"}},"
|
| + "\"error\": \"This is an error message.\"}";
|
| +
|
| + request->onUpdatePaymentDetails(ScriptValue::from(scope.getScriptState(), fromJSONString(scope.getScriptState(), detailWithErrorMsg, scope.getExceptionState())));
|
| + EXPECT_FALSE(scope.getExceptionState().hadException());
|
| +}
|
| +
|
| } // namespace
|
| } // namespace blink
|
|
|