| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "components/autofill/content/browser/wallet/wallet_service_url.h" | 6 #include "components/autofill/content/browser/wallet/wallet_service_url.h" |
| 7 #include "components/autofill/core/common/autofill_switches.h" | 7 #include "components/autofill/core/common/autofill_switches.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| 11 namespace autofill { | 11 namespace autofill { |
| 12 namespace wallet { | 12 namespace wallet { |
| 13 | 13 |
| 14 TEST(WalletServiceUrl, CheckDefaultUrls) { | 14 TEST(WalletServiceUrl, CheckDefaultUrls) { |
| 15 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" | 15 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" |
| 16 "autocheckout/v1/getWalletItemsJwtless", | 16 "autocheckout/v1/getWalletItemsJwtless", |
| 17 GetGetWalletItemsUrl().spec()); | 17 GetGetWalletItemsUrl().spec()); |
| 18 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" | 18 EXPECT_EQ("https://wallet-web.sandbox.google.com/online-secure/v2/" |
| 19 "autocheckout/v1/getFullWalletJwtless", | 19 "autocheckout/v1/getFullWalletJwtless?s7e=otp", |
| 20 GetGetFullWalletUrl().spec()); | 20 GetGetFullWalletUrl().spec()); |
| 21 EXPECT_EQ("https://wallet-web.sandbox.google.com/manage/w/0/#paymentMethods:", | 21 EXPECT_EQ("https://wallet-web.sandbox.google.com/manage/w/0/#paymentMethods:", |
| 22 GetManageInstrumentsUrl().spec()); | 22 GetManageInstrumentsUrl().spec()); |
| 23 EXPECT_EQ("https://wallet-web.sandbox.google.com/manage/w/0/" | 23 EXPECT_EQ("https://wallet-web.sandbox.google.com/manage/w/0/" |
| 24 "#settings:addresses", | 24 "#settings:addresses", |
| 25 GetManageAddressesUrl().spec()); | 25 GetManageAddressesUrl().spec()); |
| 26 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" | 26 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" |
| 27 "autocheckout/v1/acceptLegalDocument", | 27 "autocheckout/v1/acceptLegalDocument", |
| 28 GetAcceptLegalDocumentsUrl().spec()); | 28 GetAcceptLegalDocumentsUrl().spec()); |
| 29 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" | 29 EXPECT_EQ("https://wallet-web.sandbox.google.com/online-secure/v2/" |
| 30 "autocheckout/v1/authenticateInstrument", | 30 "autocheckout/v1/authenticateInstrument?s7e=cvn", |
| 31 GetAuthenticateInstrumentUrl().spec()); | 31 GetAuthenticateInstrumentUrl().spec()); |
| 32 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" | 32 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" |
| 33 "autocheckout/v1/reportStatus", | 33 "autocheckout/v1/reportStatus", |
| 34 GetSendStatusUrl().spec()); | 34 GetSendStatusUrl().spec()); |
| 35 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" | 35 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" |
| 36 "autocheckout/v1/saveToWallet", | 36 "autocheckout/v1/saveToWallet", |
| 37 GetSaveToWalletNoEscrowUrl().spec()); |
| 38 EXPECT_EQ("https://wallet-web.sandbox.google.com/online-secure/v2/" |
| 39 "autocheckout/v1/saveToWallet?s7e=card_number%3Bcvn", |
| 37 GetSaveToWalletUrl().spec()); | 40 GetSaveToWalletUrl().spec()); |
| 38 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/" | 41 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/" |
| 39 "passiveauth?isChromePayments=true", | 42 "passiveauth?isChromePayments=true", |
| 40 GetPassiveAuthUrl().spec()); | 43 GetPassiveAuthUrl().spec()); |
| 41 EXPECT_EQ("https://wallet-web.sandbox.google.com/online-secure/" | |
| 42 "temporarydata/cvv?s7e=cvv", | |
| 43 GetEncryptionUrl().spec()); | |
| 44 EXPECT_EQ("https://wallet-web.sandbox.google.com/checkout/dehEfe?" | |
| 45 "s7e=cardNumber%3Bcvv", | |
| 46 GetEscrowUrl().spec()); | |
| 47 } | 44 } |
| 48 | 45 |
| 49 TEST(WalletServiceUrl, IsUsingProd) { | 46 TEST(WalletServiceUrl, IsUsingProd) { |
| 50 // The sandbox servers are the default (for now). Update if this changes. | 47 // The sandbox servers are the default (for now). Update if this changes. |
| 51 EXPECT_FALSE(IsUsingProd()); | 48 EXPECT_FALSE(IsUsingProd()); |
| 52 | 49 |
| 53 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 50 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 54 command_line->AppendSwitch(switches::kWalletServiceUseProd); | 51 command_line->AppendSwitch(switches::kWalletServiceUseProd); |
| 55 EXPECT_TRUE(IsUsingProd()); | 52 EXPECT_TRUE(IsUsingProd()); |
| 56 | 53 |
| 57 const GURL prod_get_items_url = GetGetWalletItemsUrl(); | 54 const GURL prod_get_items_url = GetGetWalletItemsUrl(); |
| 58 command_line->AppendSwitchASCII(switches::kWalletServiceUrl, "http://goo.gl"); | 55 command_line->AppendSwitchASCII(switches::kWalletServiceUrl, "http://goo.gl"); |
| 59 EXPECT_FALSE(IsUsingProd()); | 56 EXPECT_FALSE(IsUsingProd()); |
| 60 | 57 |
| 61 ASSERT_NE(prod_get_items_url, GetGetWalletItemsUrl()); | 58 ASSERT_NE(prod_get_items_url, GetGetWalletItemsUrl()); |
| 62 } | 59 } |
| 63 | 60 |
| 64 } // namespace wallet | 61 } // namespace wallet |
| 65 } // namespace autofill | 62 } // namespace autofill |
| OLD | NEW |