summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorahutter@chromium.org <ahutter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-16 09:37:09 +0000
committerahutter@chromium.org <ahutter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-16 09:37:09 +0000
commit74192a2f5906b00c160df46623f8211e1349e713 (patch)
treecf0f818afbf4a6920dfa97ccedbb469604c24dd8 /components
parent3e2e9c5625c3114c4b83b0e0b0ab76eb8b2a18e9 (diff)
downloadchromium_src-74192a2f5906b00c160df46623f8211e1349e713.zip
chromium_src-74192a2f5906b00c160df46623f8211e1349e713.tar.gz
chromium_src-74192a2f5906b00c160df46623f8211e1349e713.tar.bz2
Make sandbox the default Wallet service url for now.
BUG=176135 Review URL: https://chromiumcodereview.appspot.com/12550013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188565 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r--components/autofill/browser/wallet/wallet_service_url.cc44
-rw-r--r--components/autofill/browser/wallet/wallet_service_url_unittest.cc33
-rw-r--r--components/autofill/common/autofill_switches.cc4
-rw-r--r--components/autofill/common/autofill_switches.h1
4 files changed, 60 insertions, 22 deletions
diff --git a/components/autofill/browser/wallet/wallet_service_url.cc b/components/autofill/browser/wallet/wallet_service_url.cc
index 47bc105..7e6876e 100644
--- a/components/autofill/browser/wallet/wallet_service_url.cc
+++ b/components/autofill/browser/wallet/wallet_service_url.cc
@@ -14,14 +14,25 @@
namespace {
-const char kDefaultWalletServiceUrl[] = "https://wallet.google.com/";
+const char kProdWalletServiceUrl[] = "https://wallet.google.com/";
+
+// TODO(ahutter): Remove this once production is ready.
+const char kSandboxWalletServiceUrl[] =
+ "https://payments-form-dogfood.sandbox.google.com/";
+
+// TODO(ahutter): Remove this once production is ready.
+const char kSandboxWalletSecureServiceUrl[] =
+ "https://wallet-web.sandbox.google.com/";
GURL GetWalletHostUrl() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
std::string wallet_service_hostname =
command_line.GetSwitchValueASCII(switches::kWalletServiceUrl);
- return !wallet_service_hostname.empty() ? GURL(wallet_service_hostname) :
- GURL(kDefaultWalletServiceUrl);
+ if (!wallet_service_hostname.empty())
+ return GURL(wallet_service_hostname);
+ if (command_line.HasSwitch(switches::kWalletServiceUseProd))
+ return GURL(kProdWalletServiceUrl);
+ return GURL(kSandboxWalletServiceUrl);
}
GURL GetBaseWalletUrl() {
@@ -36,8 +47,11 @@ GURL GetBaseSecureUrl() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
std::string wallet_secure_url =
command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl);
- return !wallet_secure_url.empty() ? GURL(wallet_secure_url) :
- GURL(kDefaultWalletServiceUrl);
+ if (!wallet_secure_url.empty())
+ return GURL(wallet_secure_url);
+ if (command_line.HasSwitch(switches::kWalletServiceUseProd))
+ return GURL(kProdWalletServiceUrl);
+ return GURL(kSandboxWalletSecureServiceUrl);
}
} // anonymous namespace
@@ -74,11 +88,27 @@ GURL GetPassiveAuthUrl() {
}
GURL GetEncryptionUrl() {
- return GetWalletHostUrl().Resolve("online-secure/temporarydata/cvv?s7e=cvv");
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ // TODO(ahutter): Stop checking these switches once we switch over to prod.
+ if (command_line.HasSwitch(switches::kWalletServiceUseProd) ||
+ command_line.HasSwitch(switches::kWalletServiceUrl)) {
+ return GetWalletHostUrl().Resolve(
+ "online-secure/temporarydata/cvv?s7e=cvv");
+ } else {
+ return GetBaseSecureUrl().Resolve(
+ "online-secure/temporarydata/cvv?s7e=cvv");
+ }
}
GURL GetEscrowUrl() {
- return GetBaseSecureUrl().Resolve("dehEfe?s7e=cardNumber%3Bcvv");
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ // TODO(ahutter): Stop checking these switches once we switch over to prod.
+ if (command_line.HasSwitch(switches::kWalletServiceUseProd) ||
+ command_line.HasSwitch(switches::kWalletServiceUrl)) {
+ return GetBaseSecureUrl().Resolve("dehEfe?s7e=cardNumber%3Bcvv");
+ } else {
+ return GetBaseSecureUrl().Resolve("checkout/dehEfe?s7e=cardNumber%3Bcvv");
+ }
}
GURL GetSignInUrl() {
diff --git a/components/autofill/browser/wallet/wallet_service_url_unittest.cc b/components/autofill/browser/wallet/wallet_service_url_unittest.cc
index c303be4..cc2b1f8 100644
--- a/components/autofill/browser/wallet/wallet_service_url_unittest.cc
+++ b/components/autofill/browser/wallet/wallet_service_url_unittest.cc
@@ -10,29 +10,32 @@ namespace autofill {
namespace wallet {
TEST(WalletServiceUrl, CheckDefaultUrls) {
- ASSERT_EQ("https://wallet.google.com/online/v2/wallet/autocheckout/v1/"
- "getWalletItemsJwtless",
+ ASSERT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/"
+ "autocheckout/v1/getWalletItemsJwtless",
GetGetWalletItemsUrl().spec());
- ASSERT_EQ("https://wallet.google.com/online/v2/wallet/autocheckout/v1/"
- "getFullWalletJwtless",
+ ASSERT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/"
+ "autocheckout/v1/getFullWalletJwtless",
GetGetFullWalletUrl().spec());
- ASSERT_EQ("https://wallet.google.com/online/v2/wallet/autocheckout/v1/"
- "acceptLegalDocument",
+ ASSERT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/"
+ "autocheckout/v1/acceptLegalDocument",
GetAcceptLegalDocumentsUrl().spec());
- ASSERT_EQ("https://wallet.google.com/online/v2/wallet/autocheckout/v1/"
- "authenticateInstrument",
+ ASSERT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/"
+ "autocheckout/v1/authenticateInstrument",
GetAuthenticateInstrumentUrl().spec());
- ASSERT_EQ("https://wallet.google.com/online/v2/wallet/autocheckout/v1/"
- "reportStatus",
+ ASSERT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/"
+ "autocheckout/v1/reportStatus",
GetSendStatusUrl().spec());
- ASSERT_EQ("https://wallet.google.com/online/v2/wallet/autocheckout/v1/"
- "saveToWallet",
+ ASSERT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/wallet/"
+ "autocheckout/v1/saveToWallet",
GetSaveToWalletUrl().spec());
- ASSERT_EQ("https://wallet.google.com/online/v2/passiveauth",
+ ASSERT_EQ("https://payments-form-dogfood.sandbox.google.com/online/v2/"
+ "passiveauth",
GetPassiveAuthUrl().spec());
- ASSERT_EQ("https://wallet.google.com/online-secure/temporarydata/cvv?s7e=cvv",
+ ASSERT_EQ("https://wallet-web.sandbox.google.com/online-secure/"
+ "temporarydata/cvv?s7e=cvv",
GetEncryptionUrl().spec());
- ASSERT_EQ("https://wallet.google.com/dehEfe?s7e=cardNumber%3Bcvv",
+ ASSERT_EQ("https://wallet-web.sandbox.google.com/checkout/dehEfe?"
+ "s7e=cardNumber%3Bcvv",
GetEscrowUrl().spec());
}
diff --git a/components/autofill/common/autofill_switches.cc b/components/autofill/common/autofill_switches.cc
index 7f38afd0..933dc8d 100644
--- a/components/autofill/common/autofill_switches.cc
+++ b/components/autofill/common/autofill_switches.cc
@@ -27,4 +27,8 @@ const char kWalletSecureServiceUrl[] = "wallet-secure-service-url";
// API calls.
const char kWalletServiceUrl[] = "wallet-service-url";
+// Enable production Online Wallet service. If this flag is not set, the sandbox
+// service will be used.
+const char kWalletServiceUseProd[] = "wallet-service-use-prod";
+
} // namespace switches
diff --git a/components/autofill/common/autofill_switches.h b/components/autofill/common/autofill_switches.h
index ca16673..f127ca9 100644
--- a/components/autofill/common/autofill_switches.h
+++ b/components/autofill/common/autofill_switches.h
@@ -15,6 +15,7 @@ extern const char kEnableExperimentalFormFilling[];
extern const char kShowAutofillTypePredictions[];
extern const char kWalletSecureServiceUrl[];
extern const char kWalletServiceUrl[];
+extern const char kWalletServiceUseProd[];
} // namespace switches