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 "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 const GURL fake_service_url = GURL("http://goo.gl"); | 108 const GURL fake_service_url = GURL("http://goo.gl"); |
109 command_line->AppendSwitchASCII(switches::kWalletServiceUrl, | 109 command_line->AppendSwitchASCII(switches::kWalletServiceUrl, |
110 fake_service_url.spec()); | 110 fake_service_url.spec()); |
111 | 111 |
112 const GURL flag_get_items_url = GetGetWalletItemsUrl(0); | 112 const GURL flag_get_items_url = GetGetWalletItemsUrl(0); |
113 EXPECT_NE(sandbox_get_items_url, flag_get_items_url); | 113 EXPECT_NE(sandbox_get_items_url, flag_get_items_url); |
114 EXPECT_EQ(fake_service_url.GetOrigin(), flag_get_items_url.GetOrigin()); | 114 EXPECT_EQ(fake_service_url.GetOrigin(), flag_get_items_url.GetOrigin()); |
115 } | 115 } |
116 | 116 |
117 TEST(WalletServiceUrl, IsSignInContinueUrl) { | 117 TEST(WalletServiceUrl, IsSignInContinueUrl) { |
118 EXPECT_TRUE(GetSignInContinueUrl().SchemeIsSecure()); | 118 EXPECT_TRUE(GetSignInContinueUrl().SchemeIsCryptographic()); |
119 | 119 |
120 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 120 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
121 command_line->AppendSwitchASCII(switches::kWalletServiceUseSandbox, "1"); | 121 command_line->AppendSwitchASCII(switches::kWalletServiceUseSandbox, "1"); |
122 | 122 |
123 // authuser query param is respected. | 123 // authuser query param is respected. |
124 const char sign_in_url[] = "https://wallet-web.sandbox.google.com/online/v2/" | 124 const char sign_in_url[] = "https://wallet-web.sandbox.google.com/online/v2/" |
125 "u/0/passiveauth?isChromePayments=true&authuser=4"; | 125 "u/0/passiveauth?isChromePayments=true&authuser=4"; |
126 size_t user_index = 100; | 126 size_t user_index = 100; |
127 EXPECT_TRUE(IsSignInContinueUrl(GURL(sign_in_url), &user_index)); | 127 EXPECT_TRUE(IsSignInContinueUrl(GURL(sign_in_url), &user_index)); |
128 EXPECT_EQ(4U, user_index); | 128 EXPECT_EQ(4U, user_index); |
(...skipping 21 matching lines...) Expand all Loading... |
150 EXPECT_TRUE(IsSignInRelatedUrl(GetSignInUrl(0))); | 150 EXPECT_TRUE(IsSignInRelatedUrl(GetSignInUrl(0))); |
151 EXPECT_TRUE(IsSignInRelatedUrl(GetAddAccountUrl())); | 151 EXPECT_TRUE(IsSignInRelatedUrl(GetAddAccountUrl())); |
152 EXPECT_TRUE(IsSignInRelatedUrl(GURL("https://accounts.youtube.com"))); | 152 EXPECT_TRUE(IsSignInRelatedUrl(GURL("https://accounts.youtube.com"))); |
153 EXPECT_TRUE(IsSignInRelatedUrl(GURL("https://accounts.youtube.com/"))); | 153 EXPECT_TRUE(IsSignInRelatedUrl(GURL("https://accounts.youtube.com/"))); |
154 EXPECT_TRUE(IsSignInRelatedUrl(GURL("https://accounts.google.com"))); | 154 EXPECT_TRUE(IsSignInRelatedUrl(GURL("https://accounts.google.com"))); |
155 EXPECT_FALSE(IsSignInRelatedUrl(GURL("http://google.com"))); | 155 EXPECT_FALSE(IsSignInRelatedUrl(GURL("http://google.com"))); |
156 } | 156 } |
157 | 157 |
158 } // namespace wallet | 158 } // namespace wallet |
159 } // namespace autofill | 159 } // namespace autofill |
OLD | NEW |