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

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

Issue 148513010: Eliminate ProfileOAuth2TokenService being a BCKS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 6 years, 10 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/fake_profile_oauth2_token_service.h" 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
11 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
12 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
13 #include "content/public/test/test_browser_thread.h" 14 #include "content/public/test/test_browser_thread.h"
14 #include "google_apis/gaia/google_service_auth_error.h" 15 #include "google_apis/gaia/google_service_auth_error.h"
15 #include "google_apis/gaia/oauth2_token_service.h" 16 #include "google_apis/gaia/oauth2_token_service.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace { 19 namespace {
19 20
20 const char kAccessToken[] = "access_token"; 21 const char kAccessToken[] = "access_token";
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 FakeProfileOAuth2TokenService* oauth2_service_; 77 FakeProfileOAuth2TokenService* oauth2_service_;
77 78
78 scoped_ptr<ProfileOAuth2TokenServiceRequest> request_; 79 scoped_ptr<ProfileOAuth2TokenServiceRequest> request_;
79 }; 80 };
80 81
81 void ProfileOAuth2TokenServiceRequestTest::SetUp() { 82 void ProfileOAuth2TokenServiceRequestTest::SetUp() {
82 ui_thread_.reset(new content::TestBrowserThread(content::BrowserThread::UI, 83 ui_thread_.reset(new content::TestBrowserThread(content::BrowserThread::UI,
83 &ui_loop_)); 84 &ui_loop_));
84 TestingProfile::Builder builder; 85 TestingProfile::Builder builder;
85 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), 86 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
86 &FakeProfileOAuth2TokenService::Build); 87 &FakeProfileOAuth2TokenServiceWrapper::Build);
87 profile_ = builder.Build(); 88 profile_ = builder.Build();
88 89
89 oauth2_service_ = (FakeProfileOAuth2TokenService*) 90 oauth2_service_ = (FakeProfileOAuth2TokenService*)
90 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 91 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
91 } 92 }
92 93
93 TEST_F(ProfileOAuth2TokenServiceRequestTest, 94 TEST_F(ProfileOAuth2TokenServiceRequestTest,
94 Failure) { 95 Failure) {
95 scoped_ptr<ProfileOAuth2TokenServiceRequest> request( 96 scoped_ptr<ProfileOAuth2TokenServiceRequest> request(
96 ProfileOAuth2TokenServiceRequest::CreateAndStart( 97 ProfileOAuth2TokenServiceRequest::CreateAndStart(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 &consumer_)); 150 &consumer_));
150 oauth2_service_->IssueTokenForAllPendingRequests(kAccessToken, 151 oauth2_service_->IssueTokenForAllPendingRequests(kAccessToken,
151 base::Time::Max()); 152 base::Time::Max());
152 ui_loop_.RunUntilIdle(); 153 ui_loop_.RunUntilIdle();
153 request.reset(); 154 request.reset();
154 EXPECT_EQ(1, consumer_.number_of_successful_tokens_); 155 EXPECT_EQ(1, consumer_.number_of_successful_tokens_);
155 EXPECT_EQ(0, consumer_.number_of_errors_); 156 EXPECT_EQ(0, consumer_.number_of_errors_);
156 } 157 }
157 158
158 } // namespace 159 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/signin/profile_oauth2_token_service_factory.cc ('k') | chrome/browser/signin/signin_global_error_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698