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

Side by Side Diff: chrome/browser/signin/profile_oauth2_token_service_request_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "chrome/browser/signin/profile_oauth2_token_service_request.h" 4 #include "chrome/browser/signin/profile_oauth2_token_service_request.h"
5 5
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "chrome/browser/signin/oauth2_token_service.h" 10 #include "chrome/browser/signin/oauth2_token_service.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 request.reset(new MockProfileOAuth2TokenService::Request( 145 request.reset(new MockProfileOAuth2TokenService::Request(
146 consumer, 146 consumer,
147 GoogleServiceAuthError(GoogleServiceAuthError::NONE), 147 GoogleServiceAuthError(GoogleServiceAuthError::NONE),
148 oauth2_access_token_)); 148 oauth2_access_token_));
149 } else { 149 } else {
150 request.reset(new MockProfileOAuth2TokenService::Request( 150 request.reset(new MockProfileOAuth2TokenService::Request(
151 consumer, 151 consumer,
152 GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE), 152 GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE),
153 std::string())); 153 std::string()));
154 } 154 }
155 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 155 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
156 &MockProfileOAuth2TokenService::InformConsumer, request->AsWeakPtr())); 156 &MockProfileOAuth2TokenService::InformConsumer, request->AsWeakPtr()));
157 return request.PassAs<OAuth2TokenService::Request>(); 157 return request.PassAs<OAuth2TokenService::Request>();
158 } 158 }
159 159
160 static BrowserContextKeyedService* CreateOAuth2TokenService( 160 static BrowserContextKeyedService* CreateOAuth2TokenService(
161 content::BrowserContext* profile) { 161 content::BrowserContext* profile) {
162 return new MockProfileOAuth2TokenService(); 162 return new MockProfileOAuth2TokenService();
163 } 163 }
164 164
165 class ProfileOAuth2TokenServiceRequestTest : public testing::Test { 165 class ProfileOAuth2TokenServiceRequestTest : public testing::Test {
166 public: 166 public:
167 virtual void SetUp() OVERRIDE; 167 virtual void SetUp() OVERRIDE;
168 168
169 protected: 169 protected:
170 MessageLoop ui_loop_; 170 base::MessageLoop ui_loop_;
171 scoped_ptr<content::TestBrowserThread> ui_thread_; 171 scoped_ptr<content::TestBrowserThread> ui_thread_;
172 172
173 scoped_ptr<Profile> profile_; 173 scoped_ptr<Profile> profile_;
174 TestingOAuth2TokenServiceConsumer consumer_; 174 TestingOAuth2TokenServiceConsumer consumer_;
175 MockProfileOAuth2TokenService* oauth2_service_; 175 MockProfileOAuth2TokenService* oauth2_service_;
176 176
177 scoped_ptr<ProfileOAuth2TokenServiceRequest> request_; 177 scoped_ptr<ProfileOAuth2TokenServiceRequest> request_;
178 }; 178 };
179 179
180 void ProfileOAuth2TokenServiceRequestTest::SetUp() { 180 void ProfileOAuth2TokenServiceRequestTest::SetUp() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 profile_.get(), 233 profile_.get(),
234 std::set<std::string>(), 234 std::set<std::string>(),
235 &consumer_)); 235 &consumer_));
236 ui_loop_.RunUntilIdle(); 236 ui_loop_.RunUntilIdle();
237 request.reset(); 237 request.reset();
238 EXPECT_EQ(1, consumer_.number_of_successful_tokens_); 238 EXPECT_EQ(1, consumer_.number_of_successful_tokens_);
239 EXPECT_EQ(0, consumer_.number_of_errors_); 239 EXPECT_EQ(0, consumer_.number_of_errors_);
240 } 240 }
241 241
242 } // namespace 242 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/signin/oauth2_token_service.cc ('k') | chrome/browser/signin/signin_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698