| OLD | NEW |
| 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" | 9 #include "chrome/browser/invalidation/ticl_invalidation_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 scoped_ptr<IdentityProvider>(new FakeIdentityProvider(&token_service_)), | 56 scoped_ptr<IdentityProvider>(new FakeIdentityProvider(&token_service_)), |
| 57 scoped_ptr<TiclSettingsProvider>( | 57 scoped_ptr<TiclSettingsProvider>( |
| 58 new TiclProfileSettingsProvider(&profile_)), | 58 new TiclProfileSettingsProvider(&profile_)), |
| 59 gcm::GCMProfileServiceFactory::GetForProfile(&profile_)->driver(), | 59 gcm::GCMProfileServiceFactory::GetForProfile(&profile_)->driver(), |
| 60 profile_.GetRequestContext())); | 60 profile_.GetRequestContext())); |
| 61 invalidation_service_->Init(scoped_ptr<syncer::InvalidationStateTracker>( | 61 invalidation_service_->Init(scoped_ptr<syncer::InvalidationStateTracker>( |
| 62 new syncer::FakeInvalidationStateTracker)); | 62 new syncer::FakeInvalidationStateTracker)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void TiclProfileSettingsProviderTest::TearDown() { | 65 void TiclProfileSettingsProviderTest::TearDown() { |
| 66 invalidation_service_->Shutdown(); | 66 invalidation_service_.reset(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 TiclInvalidationService::InvalidationNetworkChannel | 69 TiclInvalidationService::InvalidationNetworkChannel |
| 70 TiclProfileSettingsProviderTest::GetNetworkChannel() { | 70 TiclProfileSettingsProviderTest::GetNetworkChannel() { |
| 71 return invalidation_service_->network_channel_type_; | 71 return invalidation_service_->network_channel_type_; |
| 72 } | 72 } |
| 73 | 73 |
| 74 TEST_F(TiclProfileSettingsProviderTest, ChannelSelectionTest) { | 74 TEST_F(TiclProfileSettingsProviderTest, ChannelSelectionTest) { |
| 75 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); | 75 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); |
| 76 PrefService* prefs = profile_.GetPrefs(); | 76 PrefService* prefs = profile_.GetPrefs(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 101 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); | 101 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); |
| 102 | 102 |
| 103 // If invalidation channel setting is enabled first and the GCM setting is | 103 // If invalidation channel setting is enabled first and the GCM setting is |
| 104 // enabled after that, switch to GCM channel. | 104 // enabled after that, switch to GCM channel. |
| 105 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true); | 105 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true); |
| 106 prefs->SetBoolean(prefs::kGCMChannelEnabled, true); | 106 prefs->SetBoolean(prefs::kGCMChannelEnabled, true); |
| 107 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); | 107 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace invalidation | 110 } // namespace invalidation |
| OLD | NEW |