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

Side by Side Diff: components/payments/payments_validators_test.cc

Issue 2477883002: [Web Payments] Mojom namespace blink -> payments (Closed)
Patch Set: Fix WebKit tests Created 4 years, 1 month 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 "components/payments/payments_validators.h" 5 #include "components/payments/payments_validators.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include <ostream> // NOLINT 8 #include <ostream> // NOLINT
9 9
10 namespace blink { 10 namespace payments {
11 namespace { 11 namespace {
12 12
13 struct CurrencyCodeTestCase { 13 struct CurrencyCodeTestCase {
14 CurrencyCodeTestCase(const char* code, const char* system, bool expectedValid) 14 CurrencyCodeTestCase(const char* code, const char* system, bool expectedValid)
15 : code(code), system(system), expectedValid(expectedValid) {} 15 : code(code), system(system), expectedValid(expectedValid) {}
16 ~CurrencyCodeTestCase() {} 16 ~CurrencyCodeTestCase() {}
17 17
18 const char* code; 18 const char* code;
19 const char* system; 19 const char* system;
20 bool expectedValid; 20 bool expectedValid;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 const char* countryCode; 237 const char* countryCode;
238 const char* languageCode; 238 const char* languageCode;
239 const char* scriptCode; 239 const char* scriptCode;
240 bool expectedValid; 240 bool expectedValid;
241 }; 241 };
242 242
243 class PaymentsShippingAddressValidatorTest 243 class PaymentsShippingAddressValidatorTest
244 : public testing::TestWithParam<ShippingAddressTestCase> {}; 244 : public testing::TestWithParam<ShippingAddressTestCase> {};
245 245
246 TEST_P(PaymentsShippingAddressValidatorTest, IsValidShippingAddress) { 246 TEST_P(PaymentsShippingAddressValidatorTest, IsValidShippingAddress) {
247 blink::mojom::PaymentAddressPtr address = blink::mojom::PaymentAddress::New(); 247 payments::mojom::PaymentAddressPtr address =
248 payments::mojom::PaymentAddress::New();
248 address->country = GetParam().countryCode; 249 address->country = GetParam().countryCode;
249 address->language_code = GetParam().languageCode; 250 address->language_code = GetParam().languageCode;
250 address->script_code = GetParam().scriptCode; 251 address->script_code = GetParam().scriptCode;
251 252
252 std::string errorMessage; 253 std::string errorMessage;
253 EXPECT_EQ(GetParam().expectedValid, 254 EXPECT_EQ(GetParam().expectedValid,
254 payments::PaymentsValidators::isValidShippingAddress(address, 255 payments::PaymentsValidators::isValidShippingAddress(address,
255 &errorMessage)) 256 &errorMessage))
256 << errorMessage; 257 << errorMessage;
257 EXPECT_EQ(GetParam().expectedValid, errorMessage.empty()) << errorMessage; 258 EXPECT_EQ(GetParam().expectedValid, errorMessage.empty()) << errorMessage;
(...skipping 11 matching lines...) Expand all
269 ShippingAddressTestCase("US", "en", "", true), 270 ShippingAddressTestCase("US", "en", "", true),
270 ShippingAddressTestCase("US", "", "", true), 271 ShippingAddressTestCase("US", "", "", true),
271 // Invalid shipping addresses 272 // Invalid shipping addresses
272 ShippingAddressTestCase("", "", "", false), 273 ShippingAddressTestCase("", "", "", false),
273 ShippingAddressTestCase("InvalidCountryCode", "", "", false), 274 ShippingAddressTestCase("InvalidCountryCode", "", "", false),
274 ShippingAddressTestCase("US", "InvalidLanguageCode", "", false), 275 ShippingAddressTestCase("US", "InvalidLanguageCode", "", false),
275 ShippingAddressTestCase("US", "en", "InvalidScriptCode", false), 276 ShippingAddressTestCase("US", "en", "InvalidScriptCode", false),
276 ShippingAddressTestCase("US", "", "Latn", false))); 277 ShippingAddressTestCase("US", "", "Latn", false)));
277 278
278 } // namespace 279 } // namespace
279 } // namespace blink 280 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/payments_validators.cc ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698