| 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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 10 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); | 85 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); |
| 86 | 86 |
| 87 prefs->SetBoolean(gcm::prefs::kGCMChannelStatus, true); | 87 prefs->SetBoolean(gcm::prefs::kGCMChannelStatus, true); |
| 88 prefs->ClearPref(prefs::kInvalidationServiceUseGCMChannel); | 88 prefs->ClearPref(prefs::kInvalidationServiceUseGCMChannel); |
| 89 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); | 89 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); |
| 90 | 90 |
| 91 prefs->ClearPref(gcm::prefs::kGCMChannelStatus); | 91 prefs->ClearPref(gcm::prefs::kGCMChannelStatus); |
| 92 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true); | 92 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true); |
| 93 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); | 93 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); |
| 94 | 94 |
| 95 // If invalidation channel setting says use GCM but GCM is not enabled, do not |
| 96 // fall back to push channel. |
| 97 prefs->SetBoolean(gcm::prefs::kGCMChannelStatus, false); |
| 98 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true); |
| 99 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); |
| 100 |
| 95 // If invalidation channel setting is set to false, fall back to push channel. | 101 // If invalidation channel setting is set to false, fall back to push channel. |
| 96 prefs->SetBoolean(gcm::prefs::kGCMChannelStatus, true); | 102 prefs->SetBoolean(gcm::prefs::kGCMChannelStatus, true); |
| 97 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, false); | 103 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, false); |
| 98 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); | 104 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); |
| 99 | |
| 100 // If invalidation channel setting says use GCM but GCM is not enabled, fall | |
| 101 // back to push channel. | |
| 102 prefs->SetBoolean(gcm::prefs::kGCMChannelStatus, false); | |
| 103 prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true); | |
| 104 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); | |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace invalidation | 107 } // namespace invalidation |
| OLD | NEW |