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

Side by Side Diff: chrome/common/net/gaia/gaia_authenticator2_unittest.cc

Issue 2847080: Make login cancel logic load localaccount file before attempting offline login (Closed)
Patch Set: fix check_deps failure, comment per phajdan Created 10 years, 4 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // A complete set of unit tests for GaiaAuthenticator2. 5 // A complete set of unit tests for GaiaAuthenticator2.
6 // Originally ported from GoogleAuthenticator tests. 6 // Originally ported from GoogleAuthenticator tests.
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 response); 240 response);
241 } 241 }
242 242
243 TEST_F(GaiaAuthenticator2Test, FullLogin) { 243 TEST_F(GaiaAuthenticator2Test, FullLogin) {
244 MockGaiaConsumer consumer; 244 MockGaiaConsumer consumer;
245 EXPECT_CALL(consumer, OnClientLoginSuccess(_)) 245 EXPECT_CALL(consumer, OnClientLoginSuccess(_))
246 .Times(1); 246 .Times(1);
247 247
248 TestingProfile profile; 248 TestingProfile profile;
249 249
250 MockFactory factory; 250 MockFactory<MockFetcher> factory;
251 URLFetcher::set_factory(&factory); 251 URLFetcher::set_factory(&factory);
252 252
253 GaiaAuthenticator2 auth(&consumer, std::string(), 253 GaiaAuthenticator2 auth(&consumer, std::string(),
254 profile_.GetRequestContext()); 254 profile_.GetRequestContext());
255 auth.StartClientLogin("username", 255 auth.StartClientLogin("username",
256 "password", 256 "password",
257 "service", 257 "service",
258 std::string(), 258 std::string(),
259 std::string()); 259 std::string());
260 260
261 URLFetcher::set_factory(NULL); 261 URLFetcher::set_factory(NULL);
262 } 262 }
263 263
264 TEST_F(GaiaAuthenticator2Test, FullLoginFailure) { 264 TEST_F(GaiaAuthenticator2Test, FullLoginFailure) {
265 MockGaiaConsumer consumer; 265 MockGaiaConsumer consumer;
266 EXPECT_CALL(consumer, OnClientLoginFailure(_)) 266 EXPECT_CALL(consumer, OnClientLoginFailure(_))
267 .Times(1); 267 .Times(1);
268 268
269 TestingProfile profile; 269 TestingProfile profile;
270 270
271 MockFactory factory; 271 MockFactory<MockFetcher> factory;
272 URLFetcher::set_factory(&factory); 272 URLFetcher::set_factory(&factory);
273 factory.set_success(false); 273 factory.set_success(false);
274 274
275 GaiaAuthenticator2 auth(&consumer, std::string(), 275 GaiaAuthenticator2 auth(&consumer, std::string(),
276 profile_.GetRequestContext()); 276 profile_.GetRequestContext());
277 auth.StartClientLogin("username", 277 auth.StartClientLogin("username",
278 "password", 278 "password",
279 "service", 279 "service",
280 std::string(), 280 std::string(),
281 std::string()); 281 std::string());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 URLFetcher::set_factory(NULL); 351 URLFetcher::set_factory(NULL);
352 EXPECT_TRUE(auth.HasPendingFetch()); 352 EXPECT_TRUE(auth.HasPendingFetch());
353 auth.OnURLFetchComplete(NULL, 353 auth.OnURLFetchComplete(NULL,
354 issue_auth_token_source_, 354 issue_auth_token_source_,
355 URLRequestStatus(URLRequestStatus::SUCCESS, 0), 355 URLRequestStatus(URLRequestStatus::SUCCESS, 0),
356 RC_FORBIDDEN, 356 RC_FORBIDDEN,
357 cookies_, 357 cookies_,
358 ""); 358 "");
359 EXPECT_FALSE(auth.HasPendingFetch()); 359 EXPECT_FALSE(auth.HasPendingFetch());
360 } 360 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698