Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp

Issue 1860303002: Fix CFI: Invalid cast in PaymentRequestTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8cdb6102a41d7f7058de6971a9c1bfb954dc6de5..985006d73822f75664a1b59358fc9ea839d47800 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
@@ -78,10 +78,10 @@ TEST_F(PaymentRequestTest, ItemListRequired)
TEST_F(PaymentRequestTest, AtLeastOnePaymentDetailsItemRequired)
{
- PaymentDetails emptyItems;
- emptyItems.setItems(HeapVector<PaymentItem>());
+ PaymentDetails details;
+ details.setShippingOptions(HeapVector<ShippingOption>(2, buildShippingOptionForTest()));
- PaymentRequest::create(getScriptState(), Vector<String>(1, "foo"), emptyItems, getExceptionState());
+ PaymentRequest::create(getScriptState(), Vector<String>(1, "foo"), details, getExceptionState());
EXPECT_TRUE(getExceptionState().hadException());
EXPECT_EQ(V8TypeError, getExceptionState().code());
@@ -89,8 +89,8 @@ TEST_F(PaymentRequestTest, AtLeastOnePaymentDetailsItemRequired)
TEST_F(PaymentRequestTest, NullShippingOptionWhenNoOptionsAvailable)
{
- PaymentDetails details = buildPaymentDetailsForTest();
- details.setShippingOptions(HeapVector<ShippingOption>());
+ PaymentDetails details;
+ details.setItems(HeapVector<PaymentItem>(1, buildPaymentItemForTest()));
PaymentRequest* request = PaymentRequest::create(getScriptState(), Vector<String>(1, "foo"), details, getExceptionState());
@@ -99,8 +99,9 @@ TEST_F(PaymentRequestTest, NullShippingOptionWhenNoOptionsAvailable)
TEST_F(PaymentRequestTest, NullShippingOptionWhenMultipleOptionsAvailable)
{
- PaymentDetails details = buildPaymentDetailsForTest();
- EXPECT_LE(2U, details.shippingOptions().size());
+ PaymentDetails details;
+ details.setItems(HeapVector<PaymentItem>(1, buildPaymentItemForTest()));
+ details.setShippingOptions(HeapVector<ShippingOption>(2, buildShippingOptionForTest()));
PaymentRequest* request = PaymentRequest::create(getScriptState(), Vector<String>(1, "foo"), details, getExceptionState());
@@ -109,15 +110,9 @@ TEST_F(PaymentRequestTest, NullShippingOptionWhenMultipleOptionsAvailable)
TEST_F(PaymentRequestTest, SelectSingleAvailableShippingOption)
{
- CurrencyAmount amount;
- amount.setCurrencyCode("USD");
- amount.setValue("10.00");
- ShippingOption option;
- option.setAmount(amount);
- option.setId("standard");
- option.setLabel("Standard shipping");
- PaymentDetails details = buildPaymentDetailsForTest();
- details.setShippingOptions(HeapVector<ShippingOption>(1, option));
+ PaymentDetails details;
+ details.setItems(HeapVector<PaymentItem>(1, buildPaymentItemForTest()));
+ details.setShippingOptions(HeapVector<ShippingOption>(1, buildShippingOptionForTest()));
PaymentRequest* request = PaymentRequest::create(getScriptState(), Vector<String>(1, "foo"), details, getExceptionState());
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698