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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp

Issue 2470463002: Add data parameter to payment details modifier. (Closed)
Patch Set: Rebase Created 4 years 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 unified diff | Download patch
OLDNEW
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/PaymentRequest.h" 5 #include "modules/payments/PaymentRequest.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/V8BindingForTesting.h" 9 #include "bindings/core/v8/V8BindingForTesting.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "modules/payments/PaymentDetails.h" 12 #include "modules/payments/PaymentDetails.h"
13 #include "modules/payments/PaymentOptions.h"
13 #include "modules/payments/PaymentTestHelper.h" 14 #include "modules/payments/PaymentTestHelper.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include <ostream> // NOLINT 16 #include <ostream> // NOLINT
16 17
17 namespace blink { 18 namespace blink {
18 namespace { 19 namespace {
19 20
20 class DetailsTestCase { 21 class DetailsTestCase {
21 public: 22 public:
22 DetailsTestCase(PaymentTestDetailToChange detail, 23 DetailsTestCase(PaymentTestDetailToChange detail,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return out; 123 return out;
123 } 124 }
124 125
125 class PaymentRequestDetailsTest 126 class PaymentRequestDetailsTest
126 : public testing::TestWithParam<DetailsTestCase> {}; 127 : public testing::TestWithParam<DetailsTestCase> {};
127 128
128 TEST_P(PaymentRequestDetailsTest, ValidatesDetails) { 129 TEST_P(PaymentRequestDetailsTest, ValidatesDetails) {
129 V8TestingScope scope; 130 V8TestingScope scope;
130 scope.document().setSecurityOrigin( 131 scope.document().setSecurityOrigin(
131 SecurityOrigin::create(KURL(KURL(), "https://www.example.com/"))); 132 SecurityOrigin::create(KURL(KURL(), "https://www.example.com/")));
132 PaymentRequest::create(scope.getScriptState(), 133 PaymentOptions options;
133 buildPaymentMethodDataForTest(), 134 options.setRequestShipping(true);
134 GetParam().buildDetails(), scope.getExceptionState()); 135 PaymentRequest::create(
136 scope.getScriptState(), buildPaymentMethodDataForTest(),
137 GetParam().buildDetails(), options, scope.getExceptionState());
135 138
136 EXPECT_EQ(GetParam().expectException(), 139 EXPECT_EQ(GetParam().expectException(),
137 scope.getExceptionState().hadException()); 140 scope.getExceptionState().hadException());
138 if (GetParam().expectException()) 141 if (GetParam().expectException())
139 EXPECT_EQ(GetParam().getExpectedExceptionCode(), 142 EXPECT_EQ(GetParam().getExpectedExceptionCode(),
140 scope.getExceptionState().code()); 143 scope.getExceptionState().code());
141 } 144 }
142 145
143 INSTANTIATE_TEST_CASE_P( 146 INSTANTIATE_TEST_CASE_P(
144 MissingData, 147 MissingData,
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 V8TypeError), 980 V8TypeError),
978 DetailsTestCase(PaymentTestDetailModifierItem, 981 DetailsTestCase(PaymentTestDetailModifierItem,
979 PaymentTestDataValue, 982 PaymentTestDataValue,
980 PaymentTestOverwriteValue, 983 PaymentTestOverwriteValue,
981 "1/3", 984 "1/3",
982 true, 985 true,
983 V8TypeError))); 986 V8TypeError)));
984 987
985 } // namespace 988 } // namespace
986 } // namespace blink 989 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698