| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/command_line.h" | |
| 6 #include "components/autofill/content/browser/wallet/wallet_service_url.h" | |
| 7 #include "components/autofill/core/common/autofill_switches.h" | |
| 8 #include "content/public/common/content_switches.h" | |
| 9 #include "testing/gtest/include/gtest/gtest.h" | |
| 10 #include "url/gurl.h" | |
| 11 | |
| 12 namespace autofill { | |
| 13 namespace wallet { | |
| 14 | |
| 15 namespace { | |
| 16 | |
| 17 bool IsUsingProd() { | |
| 18 return GetManageAddressesUrl(1).GetWithEmptyPath() == | |
| 19 GURL("https://wallet.google.com/"); | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 TEST(WalletServiceSandboxUrl, CheckSandboxUrls) { | |
| 24 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
| 25 switches::kWalletServiceUseSandbox, "1"); | |
| 26 | |
| 27 EXPECT_EQ("https://wallet-web.sandbox.google.com/manage/w/1/paymentMethods", | |
| 28 GetManageInstrumentsUrl(1).spec()); | |
| 29 EXPECT_EQ("https://wallet-web.sandbox.google.com/manage/w/1/settings/" | |
| 30 "addresses", | |
| 31 GetManageAddressesUrl(1).spec()); | |
| 32 } | |
| 33 | |
| 34 TEST(WalletServiceSandboxUrl, CheckProdUrls) { | |
| 35 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
| 36 switches::kWalletServiceUseSandbox, "0"); | |
| 37 | |
| 38 EXPECT_EQ("https://wallet.google.com/manage/w/1/paymentMethods", | |
| 39 GetManageInstrumentsUrl(1).spec()); | |
| 40 EXPECT_EQ("https://wallet.google.com/manage/w/1/settings/addresses", | |
| 41 GetManageAddressesUrl(1).spec()); | |
| 42 } | |
| 43 | |
| 44 // Disabling, see http://crbug.com/581880. | |
| 45 TEST(WalletServiceUrl, DISABLED_DefaultsToProd) { | |
| 46 #if defined(ENABLE_PROD_WALLET_SERVICE) | |
| 47 EXPECT_TRUE(IsUsingProd()); | |
| 48 #else | |
| 49 EXPECT_FALSE(IsUsingProd()); | |
| 50 #endif | |
| 51 | |
| 52 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 53 command_line->AppendSwitch(::switches::kReduceSecurityForTesting); | |
| 54 EXPECT_FALSE(IsUsingProd()); | |
| 55 | |
| 56 command_line->AppendSwitchASCII(switches::kWalletServiceUseSandbox, "0"); | |
| 57 EXPECT_TRUE(IsUsingProd()); | |
| 58 } | |
| 59 | |
| 60 TEST(WalletServiceUrl, IsUsingProd) { | |
| 61 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 62 command_line->AppendSwitchASCII(switches::kWalletServiceUseSandbox, "1"); | |
| 63 EXPECT_FALSE(IsUsingProd()); | |
| 64 } | |
| 65 | |
| 66 } // namespace wallet | |
| 67 } // namespace autofill | |
| OLD | NEW |