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

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

Issue 538543003: Fix copying of SAML IdP cookies on subsequent logins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update tests. Created 6 years, 3 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
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 "components/autofill/content/browser/wallet/wallet_signin_helper.h" 5 #include "components/autofill/content/browser/wallet/wallet_signin_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 net::CookieOptions httponly_options; 137 net::CookieOptions httponly_options;
138 httponly_options.set_include_httponly(); 138 httponly_options.set_include_httponly();
139 scoped_ptr<net::CanonicalCookie> cookie( 139 scoped_ptr<net::CanonicalCookie> cookie(
140 net::CanonicalCookie::Create(GetPassiveAuthUrl(0).GetWithEmptyPath(), 140 net::CanonicalCookie::Create(GetPassiveAuthUrl(0).GetWithEmptyPath(),
141 "gdToken=gdToken; HttpOnly", 141 "gdToken=gdToken; HttpOnly",
142 base::Time::Now(), 142 base::Time::Now(),
143 httponly_options)); 143 httponly_options));
144 144
145 net::CookieList cookie_list; 145 net::CookieList cookie_list;
146 cookie_list.push_back(*cookie); 146 cookie_list.push_back(*cookie);
147 cookie_monster->InitializeFrom(cookie_list); 147 cookie_monster->ImportCookies(cookie_list);
148 request_context_->GetURLRequestContext() 148 request_context_->GetURLRequestContext()
149 ->set_cookie_store(cookie_monster); 149 ->set_cookie_store(cookie_monster);
150 signin_helper_->StartWalletCookieValueFetch(); 150 signin_helper_->StartWalletCookieValueFetch();
151 base::RunLoop().RunUntilIdle(); 151 base::RunLoop().RunUntilIdle();
152 } 152 }
153 153
154 TEST_F(WalletSigninHelperTest, GetWalletCookieValueWhenMissing) { 154 TEST_F(WalletSigninHelperTest, GetWalletCookieValueWhenMissing) {
155 EXPECT_CALL(mock_delegate_, OnDidFetchWalletCookieValue(std::string())); 155 EXPECT_CALL(mock_delegate_, OnDidFetchWalletCookieValue(std::string()));
156 net::CookieMonster* cookie_monster = 156 net::CookieMonster* cookie_monster =
157 content::CreateCookieStore(content::CookieStoreConfig())-> 157 content::CreateCookieStore(content::CookieStoreConfig())->
158 GetCookieMonster(); 158 GetCookieMonster();
159 net::CookieOptions httponly_options; 159 net::CookieOptions httponly_options;
160 httponly_options.set_include_httponly(); 160 httponly_options.set_include_httponly();
161 scoped_ptr<net::CanonicalCookie> cookie( 161 scoped_ptr<net::CanonicalCookie> cookie(
162 net::CanonicalCookie::Create(GetPassiveAuthUrl(0).GetWithEmptyPath(), 162 net::CanonicalCookie::Create(GetPassiveAuthUrl(0).GetWithEmptyPath(),
163 "fake_cookie=monkeys; HttpOnly", 163 "fake_cookie=monkeys; HttpOnly",
164 base::Time::Now(), 164 base::Time::Now(),
165 httponly_options)); 165 httponly_options));
166 166
167 net::CookieList cookie_list; 167 net::CookieList cookie_list;
168 cookie_list.push_back(*cookie); 168 cookie_list.push_back(*cookie);
169 cookie_monster->InitializeFrom(cookie_list); 169 cookie_monster->ImportCookies(cookie_list);
170 request_context_->GetURLRequestContext() 170 request_context_->GetURLRequestContext()
171 ->set_cookie_store(cookie_monster); 171 ->set_cookie_store(cookie_monster);
172 signin_helper_->StartWalletCookieValueFetch(); 172 signin_helper_->StartWalletCookieValueFetch();
173 base::RunLoop().RunUntilIdle(); 173 base::RunLoop().RunUntilIdle();
174 } 174 }
175 175
176 // TODO(aruslan): http://crbug.com/188317 Need more tests. 176 // TODO(aruslan): http://crbug.com/188317 Need more tests.
177 177
178 } // namespace wallet 178 } // namespace wallet
179 } // namespace autofill 179 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/profile_auth_data_unittest.cc ('k') | net/cookies/cookie_monster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698