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

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

Issue 123363002: rAc: don't open sign in continue url in new tab (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit tests Created 6 years, 11 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
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 const GURL fake_service_url = GURL("http://goo.gl"); 91 const GURL fake_service_url = GURL("http://goo.gl");
92 command_line->AppendSwitchASCII(switches::kWalletServiceUrl, 92 command_line->AppendSwitchASCII(switches::kWalletServiceUrl,
93 fake_service_url.spec()); 93 fake_service_url.spec());
94 94
95 const GURL flag_get_items_url = GetGetWalletItemsUrl(0); 95 const GURL flag_get_items_url = GetGetWalletItemsUrl(0);
96 EXPECT_NE(sandbox_get_items_url, flag_get_items_url); 96 EXPECT_NE(sandbox_get_items_url, flag_get_items_url);
97 EXPECT_EQ(fake_service_url.GetOrigin(), flag_get_items_url.GetOrigin()); 97 EXPECT_EQ(fake_service_url.GetOrigin(), flag_get_items_url.GetOrigin());
98 } 98 }
99 99
100 TEST(WalletServiceUrl, IsSignInContinueUrl) { 100 TEST(WalletServiceUrl, IsSignInContinueUrl) {
101 EXPECT_TRUE(GetSignInContinueUrl().SchemeIsSecure());
102
101 CommandLine* command_line = CommandLine::ForCurrentProcess(); 103 CommandLine* command_line = CommandLine::ForCurrentProcess();
102 command_line->AppendSwitchASCII(switches::kWalletServiceUseSandbox, "1"); 104 command_line->AppendSwitchASCII(switches::kWalletServiceUseSandbox, "1");
103 105
104 // authuser query param is respected. 106 // authuser query param is respected.
105 const char sign_in_url[] = "https://wallet-web.sandbox.google.com/online/v2/" 107 const char sign_in_url[] = "https://wallet-web.sandbox.google.com/online/v2/"
106 "u/0/passiveauth?isChromePayments=true&authuser=4"; 108 "u/0/passiveauth?isChromePayments=true&authuser=4";
107 size_t user_index = 100; 109 size_t user_index = 100;
108 EXPECT_TRUE(IsSignInContinueUrl(GURL(sign_in_url), &user_index)); 110 EXPECT_TRUE(IsSignInContinueUrl(GURL(sign_in_url), &user_index));
109 EXPECT_EQ(4U, user_index); 111 EXPECT_EQ(4U, user_index);
110 112
(...skipping 16 matching lines...) Expand all
127 EXPECT_FALSE(IsSignInContinueUrl(GURL(not_a_sign_in_url), &user_index)); 129 EXPECT_FALSE(IsSignInContinueUrl(GURL(not_a_sign_in_url), &user_index));
128 } 130 }
129 131
130 TEST(WalletServiceUrl, IsSignInRelatedUrl) { 132 TEST(WalletServiceUrl, IsSignInRelatedUrl) {
131 EXPECT_TRUE(IsSignInRelatedUrl(GetSignInUrl())); 133 EXPECT_TRUE(IsSignInRelatedUrl(GetSignInUrl()));
132 EXPECT_FALSE(IsSignInRelatedUrl(GURL("http://google.com"))); 134 EXPECT_FALSE(IsSignInRelatedUrl(GURL("http://google.com")));
133 } 135 }
134 136
135 } // namespace wallet 137 } // namespace wallet
136 } // namespace autofill 138 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698