OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 IssueRefreshTokenForDifferentAccount(); | 275 IssueRefreshTokenForDifferentAccount(); |
276 | 276 |
277 // Credentials for a different user should be ignored, i.e. not result in a | 277 // Credentials for a different user should be ignored, i.e. not result in a |
278 // request for an access token. | 278 // request for an access token. |
279 EXPECT_EQ(0U, token_service_.GetPendingRequests().size()); | 279 EXPECT_EQ(0U, token_service_.GetPendingRequests().size()); |
280 | 280 |
281 // After all refresh tokens have been loaded, there is still no token for our | 281 // After all refresh tokens have been loaded, there is still no token for our |
282 // user, so we expect a token error. | 282 // user, so we expect a token error. |
283 EXPECT_CALL(*this, OnFailure(FamilyInfoFetcher::TOKEN_ERROR)); | 283 EXPECT_CALL(*this, OnFailure(FamilyInfoFetcher::TOKEN_ERROR)); |
284 token_service_.IssueAllRefreshTokensLoaded(); | 284 token_service_.LoadCredentials(""); |
285 } | 285 } |
286 | 286 |
287 TEST_F(FamilyInfoFetcherTest, GetTokenFailure) { | 287 TEST_F(FamilyInfoFetcherTest, GetTokenFailure) { |
288 IssueRefreshToken(); | 288 IssueRefreshToken(); |
289 | 289 |
290 fetcher_.StartGetFamilyProfile(); | 290 fetcher_.StartGetFamilyProfile(); |
291 | 291 |
292 // On failure to get an access token we expect a token error. | 292 // On failure to get an access token we expect a token error. |
293 EXPECT_CALL(*this, OnFailure(FamilyInfoFetcher::TOKEN_ERROR)); | 293 EXPECT_CALL(*this, OnFailure(FamilyInfoFetcher::TOKEN_ERROR)); |
294 token_service_.IssueErrorForAllPendingRequestsForAccount( | 294 token_service_.IssueErrorForAllPendingRequestsForAccount( |
(...skipping 17 matching lines...) Expand all Loading... |
312 IssueRefreshToken(); | 312 IssueRefreshToken(); |
313 | 313 |
314 fetcher_.StartGetFamilyProfile(); | 314 fetcher_.StartGetFamilyProfile(); |
315 | 315 |
316 IssueAccessToken(); | 316 IssueAccessToken(); |
317 | 317 |
318 // Failed API call should result in a network error. | 318 // Failed API call should result in a network error. |
319 EXPECT_CALL(*this, OnFailure(FamilyInfoFetcher::NETWORK_ERROR)); | 319 EXPECT_CALL(*this, OnFailure(FamilyInfoFetcher::NETWORK_ERROR)); |
320 SendFailedResponse(); | 320 SendFailedResponse(); |
321 } | 321 } |
OLD | NEW |