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