| 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 "components/invalidation/impl/ticl_profile_settings_provider.h" | 5 #include "components/invalidation/impl/ticl_profile_settings_provider.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "components/gcm_driver/fake_gcm_driver.h" | 11 #include "components/gcm_driver/fake_gcm_driver.h" |
| 12 #include "components/gcm_driver/gcm_channel_status_syncer.h" | 12 #include "components/gcm_driver/gcm_channel_status_syncer.h" |
| 13 #include "components/invalidation/impl/fake_invalidation_state_tracker.h" | 13 #include "components/invalidation/impl/fake_invalidation_state_tracker.h" |
| 14 #include "components/invalidation/impl/invalidation_prefs.h" | 14 #include "components/invalidation/impl/invalidation_prefs.h" |
| 15 #include "components/invalidation/impl/invalidation_state_tracker.h" | 15 #include "components/invalidation/impl/invalidation_state_tracker.h" |
| 16 #include "components/invalidation/impl/profile_invalidation_provider.h" | 16 #include "components/invalidation/impl/profile_invalidation_provider.h" |
| 17 #include "components/invalidation/impl/ticl_invalidation_service.h" | 17 #include "components/invalidation/impl/ticl_invalidation_service.h" |
| 18 #include "components/invalidation/impl/ticl_settings_provider.h" | 18 #include "components/invalidation/impl/ticl_settings_provider.h" |
| 19 #include "components/pref_registry/testing_pref_service_syncable.h" | |
| 20 #include "components/prefs/pref_service.h" | 19 #include "components/prefs/pref_service.h" |
| 20 #include "components/sync_preferences/testing_pref_service_syncable.h" |
| 21 #include "google_apis/gaia/fake_identity_provider.h" | 21 #include "google_apis/gaia/fake_identity_provider.h" |
| 22 #include "google_apis/gaia/fake_oauth2_token_service.h" | 22 #include "google_apis/gaia/fake_oauth2_token_service.h" |
| 23 #include "google_apis/gaia/identity_provider.h" | 23 #include "google_apis/gaia/identity_provider.h" |
| 24 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
| 25 #include "net/url_request/url_request_test_util.h" | 25 #include "net/url_request/url_request_test_util.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 namespace invalidation { | 28 namespace invalidation { |
| 29 | 29 |
| 30 class TiclProfileSettingsProviderTest : public testing::Test { | 30 class TiclProfileSettingsProviderTest : public testing::Test { |
| 31 protected: | 31 protected: |
| 32 TiclProfileSettingsProviderTest(); | 32 TiclProfileSettingsProviderTest(); |
| 33 ~TiclProfileSettingsProviderTest() override; | 33 ~TiclProfileSettingsProviderTest() override; |
| 34 | 34 |
| 35 // testing::Test: | 35 // testing::Test: |
| 36 void SetUp() override; | 36 void SetUp() override; |
| 37 void TearDown() override; | 37 void TearDown() override; |
| 38 | 38 |
| 39 TiclInvalidationService::InvalidationNetworkChannel GetNetworkChannel(); | 39 TiclInvalidationService::InvalidationNetworkChannel GetNetworkChannel(); |
| 40 | 40 |
| 41 base::MessageLoop message_loop_; | 41 base::MessageLoop message_loop_; |
| 42 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; | 42 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; |
| 43 gcm::FakeGCMDriver gcm_driver_; | 43 gcm::FakeGCMDriver gcm_driver_; |
| 44 user_prefs::TestingPrefServiceSyncable pref_service_; | 44 sync_preferences::TestingPrefServiceSyncable pref_service_; |
| 45 FakeOAuth2TokenService token_service_; | 45 FakeOAuth2TokenService token_service_; |
| 46 | 46 |
| 47 std::unique_ptr<TiclInvalidationService> invalidation_service_; | 47 std::unique_ptr<TiclInvalidationService> invalidation_service_; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 DISALLOW_COPY_AND_ASSIGN(TiclProfileSettingsProviderTest); | 50 DISALLOW_COPY_AND_ASSIGN(TiclProfileSettingsProviderTest); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 TiclProfileSettingsProviderTest::TiclProfileSettingsProviderTest() {} | 53 TiclProfileSettingsProviderTest::TiclProfileSettingsProviderTest() {} |
| 54 | 54 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 pref_service_.SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true); | 104 pref_service_.SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true); |
| 105 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); | 105 EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel()); |
| 106 | 106 |
| 107 // If invalidation channel setting is set to false, fall back to push channel. | 107 // If invalidation channel setting is set to false, fall back to push channel. |
| 108 pref_service_.SetBoolean(gcm::prefs::kGCMChannelStatus, true); | 108 pref_service_.SetBoolean(gcm::prefs::kGCMChannelStatus, true); |
| 109 pref_service_.SetBoolean(prefs::kInvalidationServiceUseGCMChannel, false); | 109 pref_service_.SetBoolean(prefs::kInvalidationServiceUseGCMChannel, false); |
| 110 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); | 110 EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel()); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace invalidation | 113 } // namespace invalidation |
| OLD | NEW |