| Index: components/payments/payments_validators_test.cc
|
| diff --git a/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp b/components/payments/payments_validators_test.cc
|
| similarity index 80%
|
| copy from third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp
|
| copy to components/payments/payments_validators_test.cc
|
| index 6b68029fd3a94c9f4d0d06de59bb32a410bde8bd..bf7fcc5a8dc66c044d80616d5ec06b227f96fb13 100644
|
| --- a/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp
|
| +++ b/components/payments/payments_validators_test.cc
|
| @@ -2,10 +2,9 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "modules/payments/PaymentsValidators.h"
|
| +#include "components/payments/payments_validators.h"
|
|
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| -#include "wtf/text/WTFString.h"
|
| #include <ostream> // NOLINT
|
|
|
| namespace blink {
|
| @@ -41,15 +40,15 @@ const char* longString2049() {
|
| }
|
|
|
| TEST_P(PaymentsCurrencyValidatorTest, IsValidCurrencyCodeFormat) {
|
| - String errorMessage;
|
| + std::string errorMessage;
|
| EXPECT_EQ(GetParam().expectedValid,
|
| - PaymentsValidators::isValidCurrencyCodeFormat(
|
| + payments::PaymentsValidators::isValidCurrencyCodeFormat(
|
| GetParam().code, GetParam().system, &errorMessage))
|
| << errorMessage;
|
| - EXPECT_EQ(GetParam().expectedValid, errorMessage.isEmpty()) << errorMessage;
|
| + EXPECT_EQ(GetParam().expectedValid, errorMessage.empty()) << errorMessage;
|
|
|
| EXPECT_EQ(GetParam().expectedValid,
|
| - PaymentsValidators::isValidCurrencyCodeFormat(
|
| + payments::PaymentsValidators::isValidCurrencyCodeFormat(
|
| GetParam().code, GetParam().system, nullptr));
|
| }
|
|
|
| @@ -102,14 +101,16 @@ std::ostream& operator<<(std::ostream& out, const TestCase& testCase) {
|
| class PaymentsAmountValidatorTest : public testing::TestWithParam<TestCase> {};
|
|
|
| TEST_P(PaymentsAmountValidatorTest, IsValidAmountFormat) {
|
| - String errorMessage;
|
| - EXPECT_EQ(GetParam().expectedValid, PaymentsValidators::isValidAmountFormat(
|
| - GetParam().input, &errorMessage))
|
| + std::string errorMessage;
|
| + EXPECT_EQ(GetParam().expectedValid,
|
| + payments::PaymentsValidators::isValidAmountFormat(GetParam().input,
|
| + &errorMessage))
|
| << errorMessage;
|
| - EXPECT_EQ(GetParam().expectedValid, errorMessage.isEmpty()) << errorMessage;
|
| + EXPECT_EQ(GetParam().expectedValid, errorMessage.empty()) << errorMessage;
|
|
|
| EXPECT_EQ(GetParam().expectedValid,
|
| - PaymentsValidators::isValidAmountFormat(GetParam().input, nullptr));
|
| + payments::PaymentsValidators::isValidAmountFormat(GetParam().input,
|
| + nullptr));
|
| }
|
|
|
| INSTANTIATE_TEST_CASE_P(
|
| @@ -145,16 +146,16 @@ INSTANTIATE_TEST_CASE_P(
|
| class PaymentsRegionValidatorTest : public testing::TestWithParam<TestCase> {};
|
|
|
| TEST_P(PaymentsRegionValidatorTest, IsValidCountryCodeFormat) {
|
| - String errorMessage;
|
| + std::string errorMessage;
|
| EXPECT_EQ(GetParam().expectedValid,
|
| - PaymentsValidators::isValidCountryCodeFormat(GetParam().input,
|
| - &errorMessage))
|
| + payments::PaymentsValidators::isValidCountryCodeFormat(
|
| + GetParam().input, &errorMessage))
|
| << errorMessage;
|
| - EXPECT_EQ(GetParam().expectedValid, errorMessage.isEmpty()) << errorMessage;
|
| + EXPECT_EQ(GetParam().expectedValid, errorMessage.empty()) << errorMessage;
|
|
|
| - EXPECT_EQ(
|
| - GetParam().expectedValid,
|
| - PaymentsValidators::isValidCountryCodeFormat(GetParam().input, nullptr));
|
| + EXPECT_EQ(GetParam().expectedValid,
|
| + payments::PaymentsValidators::isValidCountryCodeFormat(
|
| + GetParam().input, nullptr));
|
| }
|
|
|
| INSTANTIATE_TEST_CASE_P(CountryCodes,
|
| @@ -171,16 +172,16 @@ class PaymentsLanguageValidatorTest : public testing::TestWithParam<TestCase> {
|
| };
|
|
|
| TEST_P(PaymentsLanguageValidatorTest, IsValidLanguageCodeFormat) {
|
| - String errorMessage;
|
| + std::string errorMessage;
|
| EXPECT_EQ(GetParam().expectedValid,
|
| - PaymentsValidators::isValidLanguageCodeFormat(GetParam().input,
|
| - &errorMessage))
|
| + payments::PaymentsValidators::isValidLanguageCodeFormat(
|
| + GetParam().input, &errorMessage))
|
| << errorMessage;
|
| - EXPECT_EQ(GetParam().expectedValid, errorMessage.isEmpty()) << errorMessage;
|
| + EXPECT_EQ(GetParam().expectedValid, errorMessage.empty()) << errorMessage;
|
|
|
| - EXPECT_EQ(
|
| - GetParam().expectedValid,
|
| - PaymentsValidators::isValidLanguageCodeFormat(GetParam().input, nullptr));
|
| + EXPECT_EQ(GetParam().expectedValid,
|
| + payments::PaymentsValidators::isValidLanguageCodeFormat(
|
| + GetParam().input, nullptr));
|
| }
|
|
|
| INSTANTIATE_TEST_CASE_P(LanguageCodes,
|
| @@ -198,16 +199,16 @@ INSTANTIATE_TEST_CASE_P(LanguageCodes,
|
| class PaymentsScriptValidatorTest : public testing::TestWithParam<TestCase> {};
|
|
|
| TEST_P(PaymentsScriptValidatorTest, IsValidScriptCodeFormat) {
|
| - String errorMessage;
|
| + std::string errorMessage;
|
| EXPECT_EQ(GetParam().expectedValid,
|
| - PaymentsValidators::isValidScriptCodeFormat(GetParam().input,
|
| - &errorMessage))
|
| + payments::PaymentsValidators::isValidScriptCodeFormat(
|
| + GetParam().input, &errorMessage))
|
| << errorMessage;
|
| - EXPECT_EQ(GetParam().expectedValid, errorMessage.isEmpty()) << errorMessage;
|
| + EXPECT_EQ(GetParam().expectedValid, errorMessage.empty()) << errorMessage;
|
|
|
| - EXPECT_EQ(
|
| - GetParam().expectedValid,
|
| - PaymentsValidators::isValidScriptCodeFormat(GetParam().input, nullptr));
|
| + EXPECT_EQ(GetParam().expectedValid,
|
| + payments::PaymentsValidators::isValidScriptCodeFormat(
|
| + GetParam().input, nullptr));
|
| }
|
|
|
| INSTANTIATE_TEST_CASE_P(ScriptCodes,
|
| @@ -243,19 +244,21 @@ class PaymentsShippingAddressValidatorTest
|
| : public testing::TestWithParam<ShippingAddressTestCase> {};
|
|
|
| TEST_P(PaymentsShippingAddressValidatorTest, IsValidShippingAddress) {
|
| - mojom::blink::PaymentAddressPtr address = mojom::blink::PaymentAddress::New();
|
| + blink::mojom::PaymentAddressPtr address = blink::mojom::PaymentAddress::New();
|
| address->country = GetParam().countryCode;
|
| address->language_code = GetParam().languageCode;
|
| address->script_code = GetParam().scriptCode;
|
|
|
| - String errorMessage;
|
| + std::string errorMessage;
|
| EXPECT_EQ(GetParam().expectedValid,
|
| - PaymentsValidators::isValidShippingAddress(address, &errorMessage))
|
| + payments::PaymentsValidators::isValidShippingAddress(address,
|
| + &errorMessage))
|
| << errorMessage;
|
| - EXPECT_EQ(GetParam().expectedValid, errorMessage.isEmpty()) << errorMessage;
|
| + EXPECT_EQ(GetParam().expectedValid, errorMessage.empty()) << errorMessage;
|
|
|
| - EXPECT_EQ(GetParam().expectedValid,
|
| - PaymentsValidators::isValidShippingAddress(address, nullptr));
|
| + EXPECT_EQ(
|
| + GetParam().expectedValid,
|
| + payments::PaymentsValidators::isValidShippingAddress(address, nullptr));
|
| }
|
|
|
| INSTANTIATE_TEST_CASE_P(
|
|
|