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

Side by Side Diff: components/signin/ios/browser/profile_oauth2_token_service_ios_unittest.mm

Issue 809313009: Make the SigninErrorController a PKS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Copyrighted: 2015 Created 5 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
OLDNEW
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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "components/signin/core/browser/profile_oauth2_token_service.h" 6 #include "components/signin/core/browser/profile_oauth2_token_service.h"
7 #include "components/signin/core/browser/test_signin_client.h" 7 #include "components/signin/core/browser/test_signin_client.h"
8 #include "components/signin/ios/browser/profile_oauth2_token_service_ios.h" 8 #include "components/signin/ios/browser/profile_oauth2_token_service_ios.h"
9 #include "google_apis/gaia/gaia_urls.h" 9 #include "google_apis/gaia/gaia_urls.h"
10 #include "google_apis/gaia/oauth2_token_service_test_util.h" 10 #include "google_apis/gaia/oauth2_token_service_test_util.h"
(...skipping 14 matching lines...) Expand all
25 access_token_success_(0), 25 access_token_success_(0),
26 access_token_failure_(0), 26 access_token_failure_(0),
27 last_access_token_error_(GoogleServiceAuthError::NONE) {} 27 last_access_token_error_(GoogleServiceAuthError::NONE) {}
28 28
29 virtual void SetUp() override { 29 virtual void SetUp() override {
30 factory_.SetFakeResponse(GaiaUrls::GetInstance()->oauth2_revoke_url(), 30 factory_.SetFakeResponse(GaiaUrls::GetInstance()->oauth2_revoke_url(),
31 "", 31 "",
32 net::HTTP_OK, 32 net::HTTP_OK,
33 net::URLRequestStatus::SUCCESS); 33 net::URLRequestStatus::SUCCESS);
34 fake_provider_ = client_.GetIOSProviderAsFake(); 34 fake_provider_ = client_.GetIOSProviderAsFake();
35 oauth2_service_.Initialize(&client_); 35 oauth2_service_.Initialize(&client_, &signin_error_controller_);
36 oauth2_service_.AddObserver(this); 36 oauth2_service_.AddObserver(this);
37 } 37 }
38 38
39 virtual void TearDown() override { 39 virtual void TearDown() override {
40 oauth2_service_.RemoveObserver(this); 40 oauth2_service_.RemoveObserver(this);
41 oauth2_service_.Shutdown(); 41 oauth2_service_.Shutdown();
42 } 42 }
43 43
44 // OAuth2TokenService::Consumer implementation. 44 // OAuth2TokenService::Consumer implementation.
45 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 45 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
(...skipping 22 matching lines...) Expand all
68 token_revoked_count_ = 0; 68 token_revoked_count_ = 0;
69 tokens_loaded_count_ = 0; 69 tokens_loaded_count_ = 0;
70 token_available_count_ = 0; 70 token_available_count_ = 0;
71 access_token_failure_ = 0; 71 access_token_failure_ = 0;
72 } 72 }
73 73
74 protected: 74 protected:
75 base::MessageLoop message_loop_; 75 base::MessageLoop message_loop_;
76 net::FakeURLFetcherFactory factory_; 76 net::FakeURLFetcherFactory factory_;
77 TestSigninClient client_; 77 TestSigninClient client_;
78 SigninErrorController signin_error_controller_;
78 ios::FakeProfileOAuth2TokenServiceIOSProvider* fake_provider_; 79 ios::FakeProfileOAuth2TokenServiceIOSProvider* fake_provider_;
79 ProfileOAuth2TokenServiceIOS oauth2_service_; 80 ProfileOAuth2TokenServiceIOS oauth2_service_;
80 TestingOAuth2TokenServiceConsumer consumer_; 81 TestingOAuth2TokenServiceConsumer consumer_;
81 int token_available_count_; 82 int token_available_count_;
82 int token_revoked_count_; 83 int token_revoked_count_;
83 int tokens_loaded_count_; 84 int tokens_loaded_count_;
84 int access_token_success_; 85 int access_token_success_;
85 int access_token_failure_; 86 int access_token_failure_;
86 GoogleServiceAuthError last_access_token_error_; 87 GoogleServiceAuthError last_access_token_error_;
87 }; 88 };
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 oauth2_service_.StartRequest("account_id_1", scopes, this)); 190 oauth2_service_.StartRequest("account_id_1", scopes, this));
190 EXPECT_EQ(0, access_token_success_); 191 EXPECT_EQ(0, access_token_success_);
191 EXPECT_EQ(0, access_token_failure_); 192 EXPECT_EQ(0, access_token_failure_);
192 193
193 ResetObserverCounts(); 194 ResetObserverCounts();
194 fake_provider_->IssueAccessTokenErrorForAllRequests(); 195 fake_provider_->IssueAccessTokenErrorForAllRequests();
195 base::RunLoop().RunUntilIdle(); 196 base::RunLoop().RunUntilIdle();
196 EXPECT_EQ(0, access_token_success_); 197 EXPECT_EQ(0, access_token_success_);
197 EXPECT_EQ(1, access_token_failure_); 198 EXPECT_EQ(1, access_token_failure_);
198 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698