| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/ukm/observers/sync_disable_observer.h" | 5 #include "components/ukm/observers/sync_disable_observer.h" |
| 6 | 6 |
| 7 #include "base/observer_list.h" | 7 #include "base/observer_list.h" |
| 8 #include "components/sync/driver/fake_sync_service.h" | 8 #include "components/sync/driver/fake_sync_service.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 initialized_ = true; | 21 initialized_ = true; |
| 22 has_passphrase_ = has_passphrase; | 22 has_passphrase_ = has_passphrase; |
| 23 preferred_data_types_ = | 23 preferred_data_types_ = |
| 24 enabled ? syncer::ModelTypeSet(syncer::HISTORY_DELETE_DIRECTIVES) | 24 enabled ? syncer::ModelTypeSet(syncer::HISTORY_DELETE_DIRECTIVES) |
| 25 : syncer::ModelTypeSet(); | 25 : syncer::ModelTypeSet(); |
| 26 for (auto& observer : observers_) { | 26 for (auto& observer : observers_) { |
| 27 observer.OnStateChanged(this); | 27 observer.OnStateChanged(this); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 void Shutdown() { | 31 void Shutdown() override { |
| 32 for (auto& observer : observers_) { | 32 for (auto& observer : observers_) { |
| 33 observer.OnSyncShutdown(this); | 33 observer.OnSyncShutdown(this); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 // syncer::FakeSyncService: | 38 // syncer::FakeSyncService: |
| 39 void AddObserver(syncer::SyncServiceObserver* observer) override { | 39 void AddObserver(syncer::SyncServiceObserver* observer) override { |
| 40 observers_.AddObserver(observer); | 40 observers_.AddObserver(observer); |
| 41 } | 41 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 EXPECT_FALSE(observer.IsHistorySyncEnabledOnAllProfiles()); | 207 EXPECT_FALSE(observer.IsHistorySyncEnabledOnAllProfiles()); |
| 208 EXPECT_TRUE(observer.ResetNotified()); | 208 EXPECT_TRUE(observer.ResetNotified()); |
| 209 EXPECT_TRUE(observer.ResetPurged()); | 209 EXPECT_TRUE(observer.ResetPurged()); |
| 210 sync.Shutdown(); | 210 sync.Shutdown(); |
| 211 EXPECT_FALSE(observer.IsHistorySyncEnabledOnAllProfiles()); | 211 EXPECT_FALSE(observer.IsHistorySyncEnabledOnAllProfiles()); |
| 212 EXPECT_FALSE(observer.ResetNotified()); | 212 EXPECT_FALSE(observer.ResetNotified()); |
| 213 EXPECT_FALSE(observer.ResetPurged()); | 213 EXPECT_FALSE(observer.ResetPurged()); |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace ukm | 216 } // namespace ukm |
| OLD | NEW |