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

Side by Side Diff: chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc

Issue 319223002: Componentize TiclInvalidationService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 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 "chrome/browser/invalidation/ticl_profile_settings_provider.h" 5 #include "chrome/browser/invalidation/ticl_profile_settings_provider.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/invalidation/ticl_invalidation_service.h"
10 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/services/gcm/gcm_profile_service.h" 10 #include "chrome/browser/services/gcm/gcm_profile_service.h"
12 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" 11 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
13 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
14 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
15 #include "components/invalidation/fake_invalidation_state_tracker.h" 14 #include "components/invalidation/fake_invalidation_state_tracker.h"
15 #include "components/invalidation/ticl_invalidation_service.h"
16 #include "components/invalidation/ticl_settings_provider.h" 16 #include "components/invalidation/ticl_settings_provider.h"
17 #include "content/public/test/test_browser_thread_bundle.h" 17 #include "content/public/test/test_browser_thread_bundle.h"
18 #include "google_apis/gaia/fake_identity_provider.h" 18 #include "google_apis/gaia/fake_identity_provider.h"
19 #include "google_apis/gaia/fake_oauth2_token_service.h" 19 #include "google_apis/gaia/fake_oauth2_token_service.h"
20 #include "google_apis/gaia/identity_provider.h" 20 #include "google_apis/gaia/identity_provider.h"
21 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
22 #include "sync/notifier/invalidation_state_tracker.h" 22 #include "sync/notifier/invalidation_state_tracker.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 namespace invalidation { 25 namespace invalidation {
(...skipping 20 matching lines...) Expand all
46 }; 46 };
47 47
48 TiclProfileSettingsProviderTest::TiclProfileSettingsProviderTest() { 48 TiclProfileSettingsProviderTest::TiclProfileSettingsProviderTest() {
49 } 49 }
50 50
51 TiclProfileSettingsProviderTest::~TiclProfileSettingsProviderTest() { 51 TiclProfileSettingsProviderTest::~TiclProfileSettingsProviderTest() {
52 } 52 }
53 53
54 void TiclProfileSettingsProviderTest::SetUp() { 54 void TiclProfileSettingsProviderTest::SetUp() {
55 invalidation_service_.reset(new TiclInvalidationService( 55 invalidation_service_.reset(new TiclInvalidationService(
56 "TestUserAgent",
56 scoped_ptr<IdentityProvider>(new FakeIdentityProvider(&token_service_)), 57 scoped_ptr<IdentityProvider>(new FakeIdentityProvider(&token_service_)),
57 scoped_ptr<TiclSettingsProvider>( 58 scoped_ptr<TiclSettingsProvider>(
58 new TiclProfileSettingsProvider(&profile_)), 59 new TiclProfileSettingsProvider(&profile_)),
59 gcm::GCMProfileServiceFactory::GetForProfile(&profile_)->driver(), 60 gcm::GCMProfileServiceFactory::GetForProfile(&profile_)->driver(),
60 profile_.GetRequestContext())); 61 profile_.GetRequestContext()));
61 invalidation_service_->Init(scoped_ptr<syncer::InvalidationStateTracker>( 62 invalidation_service_->Init(scoped_ptr<syncer::InvalidationStateTracker>(
62 new syncer::FakeInvalidationStateTracker)); 63 new syncer::FakeInvalidationStateTracker));
63 } 64 }
64 65
65 void TiclProfileSettingsProviderTest::TearDown() { 66 void TiclProfileSettingsProviderTest::TearDown() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); 102 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel());
102 103
103 // If invalidation channel setting is enabled first and the GCM setting is 104 // If invalidation channel setting is enabled first and the GCM setting is
104 // enabled after that, switch to GCM channel. 105 // enabled after that, switch to GCM channel.
105 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true); 106 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true);
106 prefs->SetBoolean(prefs::kGCMChannelEnabled, true); 107 prefs->SetBoolean(prefs::kGCMChannelEnabled, true);
107 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); 108 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
108 } 109 }
109 110
110 } // namespace invalidation 111 } // namespace invalidation
OLDNEW
« no previous file with comments | « chrome/browser/invalidation/ticl_invalidation_service_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698