Chromium Code Reviews| 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 78bb515d40c44e24258d2adb45258faa1224ccfe..ca175bf1b262fa63f7ce7edc484d75faaa64b9c4 100644 |
| --- a/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp |
| +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp |
| @@ -598,5 +598,44 @@ TEST(PaymentRequestTest, NoExceptionWithErrorMessageInUpdate) { |
| EXPECT_FALSE(scope.getExceptionState().hadException()); |
| } |
| +TEST(PaymentRequestTest, |
| + ShouldResolveWithEmptyShippingOptionsIfIDsOfShippingOptionsAreDuplicated) { |
| + V8TestingScope scope; |
| + PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
| + makePaymentRequestOriginSecure(scope.document()); |
| + PaymentDetails details; |
| + details.setTotal(buildPaymentItemForTest()); |
| + HeapVector<PaymentShippingOption> shippingOptions(2); |
| + shippingOptions[0] = buildShippingOptionForTest( |
| + PaymentTestDataId, PaymentTestOverwriteValue, "standard"); |
| + shippingOptions[0].setSelected(true); |
| + shippingOptions[1] = buildShippingOptionForTest( |
| + PaymentTestDataId, PaymentTestOverwriteValue, "standard"); |
| + details.setShippingOptions(shippingOptions); |
| + PaymentOptions options; |
| + options.setRequestShipping(true); |
| + PaymentRequest* request = PaymentRequest::create( |
| + scope.getScriptState(), buildPaymentMethodDataForTest(), details, options, |
| + scope.getExceptionState()); |
| + EXPECT_FALSE(scope.getExceptionState().hadException()); |
| + EXPECT_TRUE(request->shippingOption().isNull()); |
| + request->show(scope.getScriptState()) |
| + .then(funcs.expectNoCall(), funcs.expectNoCall()); |
| + String detailWithShippingOptions = |
| + "{\"total\": {\"label\": \"Total\", \"amount\": {\"currency\": \"USD\", " |
| + "\"value\": \"5.00\"}}," |
| + "\"shippingOptions\": [{\"id\": \"standardShippingOption\", \"label\": " |
| + "\"Standard shipping\", \"amount\": {\"currency\": \"USD\", \"value\": " |
| + "\"5.00\"}, \"selected\": true}, {\"id\": \"standardShippingOption\", " |
| + "\"label\": \"Standard shipping\", \"amount\": {\"currency\": \"USD\", " |
| + "\"value\": \"5.00\"}, \"selected\": true}]}"; |
|
please use gerrit instead
2016/10/12 01:28:02
nit: newline
zino
2016/10/12 18:05:24
Done.
|
| + request->onUpdatePaymentDetails(ScriptValue::from( |
| + scope.getScriptState(), |
| + fromJSONString(scope.getScriptState(), detailWithShippingOptions, |
| + scope.getExceptionState()))); |
|
please use gerrit instead
2016/10/12 01:28:02
nit: newline
zino
2016/10/12 18:05:24
Done.
|
| + EXPECT_FALSE(scope.getExceptionState().hadException()); |
| + EXPECT_TRUE(request->shippingOption().isNull()); |
| +} |
| + |
| } // namespace |
| } // namespace blink |