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

Side by Side Diff: components/autofill/content/browser/wallet/wallet_service_url_unittest.cc

Issue 25127002: Use production Wallet service URL by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 2 months 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 | Annotate | Revision Log
OLDNEW
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://wallet.google.com/online/v2/wallet/"
16 "autocheckout/v1/getWalletItemsJwtless", 16 "autocheckout/v1/getWalletItemsJwtless",
17 GetGetWalletItemsUrl().spec()); 17 GetGetWalletItemsUrl().spec());
18 EXPECT_EQ("https://wallet-web.sandbox.google.com/online-secure/v2/" 18 EXPECT_EQ("https://wallet.google.com/online-secure/v2/"
19 "autocheckout/v1/getFullWalletJwtless?s7e=otp", 19 "autocheckout/v1/getFullWalletJwtless?s7e=otp",
20 GetGetFullWalletUrl().spec()); 20 GetGetFullWalletUrl().spec());
21 EXPECT_EQ("https://wallet-web.sandbox.google.com/manage/paymentMethods", 21 EXPECT_EQ("https://wallet.google.com/manage/paymentMethods",
22 GetManageInstrumentsUrl().spec()); 22 GetManageInstrumentsUrl().spec());
23 EXPECT_EQ("https://wallet-web.sandbox.google.com/manage/settings/addresses", 23 EXPECT_EQ("https://wallet.google.com/manage/settings/addresses",
24 GetManageAddressesUrl().spec()); 24 GetManageAddressesUrl().spec());
25 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" 25 EXPECT_EQ("https://wallet.google.com/online/v2/wallet/"
26 "autocheckout/v1/acceptLegalDocument", 26 "autocheckout/v1/acceptLegalDocument",
27 GetAcceptLegalDocumentsUrl().spec()); 27 GetAcceptLegalDocumentsUrl().spec());
28 EXPECT_EQ("https://wallet-web.sandbox.google.com/online-secure/v2/" 28 EXPECT_EQ("https://wallet.google.com/online-secure/v2/"
29 "autocheckout/v1/authenticateInstrument?s7e=cvn", 29 "autocheckout/v1/authenticateInstrument?s7e=cvn",
30 GetAuthenticateInstrumentUrl().spec()); 30 GetAuthenticateInstrumentUrl().spec());
31 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" 31 EXPECT_EQ("https://wallet.google.com/online/v2/wallet/"
32 "autocheckout/v1/reportStatus", 32 "autocheckout/v1/reportStatus",
33 GetSendStatusUrl().spec()); 33 GetSendStatusUrl().spec());
34 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/" 34 EXPECT_EQ("https://wallet.google.com/online/v2/wallet/"
35 "autocheckout/v1/saveToWallet", 35 "autocheckout/v1/saveToWallet",
36 GetSaveToWalletNoEscrowUrl().spec()); 36 GetSaveToWalletNoEscrowUrl().spec());
37 EXPECT_EQ("https://wallet-web.sandbox.google.com/online-secure/v2/" 37 EXPECT_EQ("https://wallet.google.com/online-secure/v2/"
38 "autocheckout/v1/saveToWallet?s7e=card_number%3Bcvn", 38 "autocheckout/v1/saveToWallet?s7e=card_number%3Bcvn",
39 GetSaveToWalletUrl().spec()); 39 GetSaveToWalletUrl().spec());
40 EXPECT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/" 40 EXPECT_EQ("https://wallet.google.com/online/v2/"
41 "passiveauth?isChromePayments=true", 41 "passiveauth?isChromePayments=true",
42 GetPassiveAuthUrl().spec()); 42 GetPassiveAuthUrl().spec());
43 } 43 }
44 44
45 TEST(WalletServiceUrl, IsUsingProd) { 45 TEST(WalletServiceUrl, IsUsingProd) {
46 // The sandbox servers are the default (for now). Update if this changes. 46 EXPECT_TRUE(IsUsingProd());
47
48 CommandLine* command_line = CommandLine::ForCurrentProcess();
49 command_line->AppendSwitch(switches::kWalletServiceUseSandbox);
47 EXPECT_FALSE(IsUsingProd()); 50 EXPECT_FALSE(IsUsingProd());
48 51
49 CommandLine* command_line = CommandLine::ForCurrentProcess(); 52 const GURL sandbox_get_items_url = GetGetWalletItemsUrl();
50 command_line->AppendSwitch(switches::kWalletServiceUseProd); 53 const GURL fake_service_url = GURL("http://goo.gl");
51 EXPECT_TRUE(IsUsingProd()); 54 command_line->AppendSwitchASCII(switches::kWalletServiceUrl,
55 fake_service_url.spec());
52 56
53 const GURL prod_get_items_url = GetGetWalletItemsUrl(); 57 const GURL flag_get_items_url = GetGetWalletItemsUrl();
54 command_line->AppendSwitchASCII(switches::kWalletServiceUrl, "http://goo.gl"); 58 ASSERT_NE(sandbox_get_items_url, flag_get_items_url);
55 EXPECT_FALSE(IsUsingProd()); 59 EXPECT_EQ(fake_service_url.GetOrigin(), flag_get_items_url.GetOrigin());
56
57 ASSERT_NE(prod_get_items_url, GetGetWalletItemsUrl());
58 } 60 }
59 61
60 } // namespace wallet 62 } // namespace wallet
61 } // namespace autofill 63 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698