Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_invalidation_service.h" | 5 #include "chrome/browser/invalidation/ticl_invalidation_service.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 8 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
| 9 #include "chrome/browser/invalidation/invalidation_service_test_template.h" | 9 #include "chrome/browser/invalidation/invalidation_service_test_template.h" |
| 10 #include "chrome/browser/invalidation/profile_invalidation_auth_provider.h" | 10 #include "chrome/browser/invalidation/profile_invalidation_auth_provider.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 protected: | 101 protected: |
| 102 scoped_ptr<TestingProfile> profile_; | 102 scoped_ptr<TestingProfile> profile_; |
| 103 SigninManagerBase* fake_signin_manager_; | 103 SigninManagerBase* fake_signin_manager_; |
| 104 scoped_ptr<FakeProfileOAuth2TokenService> token_service_; | 104 scoped_ptr<FakeProfileOAuth2TokenService> token_service_; |
| 105 scoped_ptr<TiclInvalidationService> invalidation_service_; | 105 scoped_ptr<TiclInvalidationService> invalidation_service_; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 TEST_F(TiclInvalidationServiceChannelTest, ChannelSelectionTest) { | 108 TEST_F(TiclInvalidationServiceChannelTest, ChannelSelectionTest) { |
| 109 TiclInvalidationService::InvalidationNetworkChannel expected_gcm_channel = | 109 TiclInvalidationService::InvalidationNetworkChannel expected_gcm_channel = |
| 110 TiclInvalidationService::GCM_NETWORK_CHANNEL; | 110 TiclInvalidationService::GCM_NETWORK_CHANNEL; |
| 111 #if defined(OS_IOS) | |
| 112 expected_gcm_channel = TiclInvalidationService::PUSH_CLIENT_CHANNEL; | |
|
pavely
2014/03/26 17:10:53
Could you replace references to expected_gcm_chann
Nicolas Zea
2014/03/26 17:47:03
Done.
| |
| 113 #endif | |
| 114 | |
| 115 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); | 111 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); |
| 116 | 112 |
| 117 // If stars allign use GCM channel. | 113 // If stars allign use GCM channel. |
| 118 profile_->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, true); | 114 profile_->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, true); |
| 119 profile_->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, | 115 profile_->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, |
| 120 true); | 116 true); |
| 121 EXPECT_EQ(expected_gcm_channel, GetNetworkChannel()); | 117 EXPECT_EQ(expected_gcm_channel, GetNetworkChannel()); |
| 122 | 118 |
| 123 // If Invalidation channel setting is not set or says false fall back to push | 119 // If Invalidation channel setting is not set or says false fall back to push |
| 124 // channel. | 120 // channel. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 144 | 140 |
| 145 // If first invalidation setting gets enabled and after that gcm setting gets | 141 // If first invalidation setting gets enabled and after that gcm setting gets |
| 146 // enabled then should still switch to GCM channel. | 142 // enabled then should still switch to GCM channel. |
| 147 profile_->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, | 143 profile_->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, |
| 148 true); | 144 true); |
| 149 profile_->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, true); | 145 profile_->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, true); |
| 150 EXPECT_EQ(expected_gcm_channel, GetNetworkChannel()); | 146 EXPECT_EQ(expected_gcm_channel, GetNetworkChannel()); |
| 151 } | 147 } |
| 152 | 148 |
| 153 } // namespace invalidation | 149 } // namespace invalidation |
| OLD | NEW |