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

Side by Side Diff: google_apis/gaia/gaia_auth_fetcher_unittest.cc

Issue 57363003: Enable account reconcilor when --new-profile-management is used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unsigned check in tests again Created 7 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 GaiaAuthFetcher. 5 // A complete set of unit tests for GaiaAuthFetcher.
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/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 MOCK_METHOD1(OnClientLoginFailure, 180 MOCK_METHOD1(OnClientLoginFailure,
181 void(const GoogleServiceAuthError& error)); 181 void(const GoogleServiceAuthError& error));
182 MOCK_METHOD2(OnIssueAuthTokenFailure, void(const std::string& service, 182 MOCK_METHOD2(OnIssueAuthTokenFailure, void(const std::string& service,
183 const GoogleServiceAuthError& error)); 183 const GoogleServiceAuthError& error));
184 MOCK_METHOD1(OnClientOAuthFailure, 184 MOCK_METHOD1(OnClientOAuthFailure,
185 void(const GoogleServiceAuthError& error)); 185 void(const GoogleServiceAuthError& error));
186 MOCK_METHOD1(OnMergeSessionFailure, void( 186 MOCK_METHOD1(OnMergeSessionFailure, void(
187 const GoogleServiceAuthError& error)); 187 const GoogleServiceAuthError& error));
188 MOCK_METHOD1(OnUberAuthTokenFailure, void( 188 MOCK_METHOD1(OnUberAuthTokenFailure, void(
189 const GoogleServiceAuthError& error)); 189 const GoogleServiceAuthError& error));
190 MOCK_METHOD1(OnListAccountsSuccess, void(const std::string& data));
190 }; 191 };
191 192
192 #if defined(OS_WIN) 193 #if defined(OS_WIN)
193 #define MAYBE_ErrorComparator DISABLED_ErrorComparator 194 #define MAYBE_ErrorComparator DISABLED_ErrorComparator
194 #else 195 #else
195 #define MAYBE_ErrorComparator ErrorComparator 196 #define MAYBE_ErrorComparator ErrorComparator
196 #endif 197 #endif
197 198
198 TEST_F(GaiaAuthFetcherTest, MAYBE_ErrorComparator) { 199 TEST_F(GaiaAuthFetcherTest, MAYBE_ErrorComparator) {
199 GoogleServiceAuthError expected_error = 200 GoogleServiceAuthError expected_error =
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 EXPECT_CALL(consumer, OnClientLoginSuccess(result)) 783 EXPECT_CALL(consumer, OnClientLoginSuccess(result))
783 .Times(1); 784 .Times(1);
784 785
785 GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext()); 786 GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext());
786 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); 787 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
787 MockFetcher mock_fetcher( 788 MockFetcher mock_fetcher(
788 oauth_login_gurl_, status, net::HTTP_OK, cookies_, data, 789 oauth_login_gurl_, status, net::HTTP_OK, cookies_, data,
789 net::URLFetcher::GET, &auth); 790 net::URLFetcher::GET, &auth);
790 auth.OnURLFetchComplete(&mock_fetcher); 791 auth.OnURLFetchComplete(&mock_fetcher);
791 } 792 }
793
794 TEST_F(GaiaAuthFetcherTest, ListAccounts) {
795 std::string data("[\"gaia.l.a.r\", ["
796 "[\"gaia.l.a\", 1, \"First Last\", \"user@gmail.com\", "
797 "\"//googleusercontent.com/A/B/C/D/photo.jpg\", 1, 1, 0]]]");
798 MockGaiaConsumer consumer;
799 EXPECT_CALL(consumer, OnListAccountsSuccess(data)).Times(1);
800
801 GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext());
802 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
803 MockFetcher mock_fetcher(GaiaUrls::GetInstance()->list_accounts_url(),
804 status, net::HTTP_OK, cookies_, data, net::URLFetcher::GET, &auth);
805 auth.OnURLFetchComplete(&mock_fetcher);
806 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698