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

Side by Side Diff: chrome/browser/invalidation/gcm_network_channel_delegate_impl_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 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 "chrome/browser/invalidation/gcm_network_channel_delegate_impl.h" 6 #include "chrome/browser/invalidation/gcm_network_channel_delegate_impl.h"
7 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" 7 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h"
8 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" 8 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
10 #include "chrome/browser/signin/profile_oauth2_token_service.h" 11 #include "chrome/browser/signin/profile_oauth2_token_service.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_bundle.h" 14 #include "content/public/test/test_browser_thread_bundle.h"
14 #include "google_apis/gaia/google_service_auth_error.h" 15 #include "google_apis/gaia/google_service_auth_error.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 namespace invalidation { 18 namespace invalidation {
18 namespace { 19 namespace {
19 20
20 class GCMNetworkChannelDelegateImplTest : public ::testing::Test { 21 class GCMNetworkChannelDelegateImplTest : public ::testing::Test {
21 protected: 22 protected:
22 GCMNetworkChannelDelegateImplTest() {} 23 GCMNetworkChannelDelegateImplTest() {}
23 24
24 virtual ~GCMNetworkChannelDelegateImplTest() {} 25 virtual ~GCMNetworkChannelDelegateImplTest() {}
25 26
26 virtual void SetUp() OVERRIDE { 27 virtual void SetUp() OVERRIDE {
27 TestingProfile::Builder builder; 28 TestingProfile::Builder builder;
28 builder.AddTestingFactory( 29 builder.AddTestingFactory(
29 ProfileOAuth2TokenServiceFactory::GetInstance(), 30 ProfileOAuth2TokenServiceFactory::GetInstance(),
30 FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService); 31 FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
31 profile_ = builder.Build(); 32 profile_ = builder.Build();
32 33
33 FakeProfileOAuth2TokenService* token_service = 34 FakeProfileOAuth2TokenService* token_service =
34 (FakeProfileOAuth2TokenService*) 35 (FakeProfileOAuth2TokenService*)
35 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 36 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
36 token_service->IssueRefreshTokenForUser("", "refresh_token"); 37 token_service->IssueRefreshTokenForUser("", "refresh_token");
37 38
38 delegate_.reset(new GCMNetworkChannelDelegateImpl(profile_.get())); 39 delegate_.reset(new GCMNetworkChannelDelegateImpl(profile_.get()));
39 } 40 }
40 41
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_EQ("", issued_tokens_[0]); 89 EXPECT_EQ("", issued_tokens_[0]);
89 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, 90 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED,
90 request_token_errors_[0].state()); 91 request_token_errors_[0].state());
91 92
92 EXPECT_NE("", issued_tokens_[1]); 93 EXPECT_NE("", issued_tokens_[1]);
93 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), request_token_errors_[1]); 94 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), request_token_errors_[1]);
94 } 95 }
95 96
96 } // namespace 97 } // namespace
97 } // namespace invalidation 98 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698