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 7e8704b3fc3c64fe23293987007ce7ded97f44d9..887fbc1698d28d41166881c565bf5991215a4e28 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("Error message is not empty."), scope.getExceptionState()); |
please use gerrit instead
2016/09/20 15:40:50
"This is an error message."
Hwanseung Lee
2016/09/20 16:01:09
Done.
|
+ |
+ EXPECT_TRUE(scope.getExceptionState().hadException()); |
+ EXPECT_EQ(V8TypeError, scope.getExceptionState().code()); |
+} |
+ |
TEST(PaymentRequestTest, NullShippingOptionWhenNoOptionsAvailable) |
{ |
V8TestingScope scope; |
@@ -393,5 +402,21 @@ TEST(PaymentRequestTest, UseTheSelectedShippingOptionFromPaymentDetailsUpdate) |
EXPECT_EQ("fast", request->shippingOption()); |
} |
+TEST(PaymentRequestTest, havingErrorMsgFromPaymentDetailsUpdate) |
please use gerrit instead
2016/09/20 15:40:50
Better name for the test is "NoExceptionWithErrorM
Hwanseung Lee
2016/09/20 16:01:09
Done.
|
+{ |
+ 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.expectCall()); |
+ String detailWithErrorMsg = "{\"total\": {\"label\": \"Total\", \"amount\": {\"currency\": \"USD\", \"value\": \"5.00\"}}," |
+ "\"error\": \"havingErrorMsg\"}"; |
+ |
+ request->onUpdatePaymentDetails(ScriptValue::from(scope.getScriptState(), fromJSONString(scope.getScriptState(), "{}", scope.getExceptionState()))); |
please use gerrit instead
2016/09/20 15:40:50
Replace "{}" with detailWithErrorMsg.
Hwanseung Lee
2016/09/20 16:01:09
Done.
|
+ EXPECT_FALSE(scope.getExceptionState().hadException()); |
+} |
+ |
} // namespace |
} // namespace blink |