| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
| 6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
| 7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/files/scoped_temp_dir.h" |
| 15 #include "base/format_macros.h" | 16 #include "base/format_macros.h" |
| 16 #include "base/location.h" | 17 #include "base/location.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
| 19 #include "base/message_loop_proxy.h" | 20 #include "base/message_loop_proxy.h" |
| 20 #include "base/scoped_temp_dir.h" | |
| 21 #include "base/string_number_conversions.h" | 21 #include "base/string_number_conversions.h" |
| 22 #include "base/stringprintf.h" | 22 #include "base/stringprintf.h" |
| 23 #include "base/test/values_test_util.h" | 23 #include "base/test/values_test_util.h" |
| 24 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
| 25 #include "base/values.h" | 25 #include "base/values.h" |
| 26 #include "sync/engine/sync_scheduler.h" | 26 #include "sync/engine/sync_scheduler.h" |
| 27 #include "sync/internal_api/public/base/model_type_test_util.h" | 27 #include "sync/internal_api/public/base/model_type_test_util.h" |
| 28 #include "sync/internal_api/public/change_record.h" | 28 #include "sync/internal_api/public/change_record.h" |
| 29 #include "sync/internal_api/public/engine/model_safe_worker.h" | 29 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 30 #include "sync/internal_api/public/engine/polling_constants.h" | 30 #include "sync/internal_api/public/engine/polling_constants.h" |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 InternalComponentsFactory::Switches GetSwitches() const { | 1020 InternalComponentsFactory::Switches GetSwitches() const { |
| 1021 return switches_; | 1021 return switches_; |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 private: | 1024 private: |
| 1025 // Needed by |sync_manager_|. | 1025 // Needed by |sync_manager_|. |
| 1026 MessageLoop message_loop_; | 1026 MessageLoop message_loop_; |
| 1027 // Needed by |sync_manager_|. | 1027 // Needed by |sync_manager_|. |
| 1028 ScopedTempDir temp_dir_; | 1028 base::ScopedTempDir temp_dir_; |
| 1029 // Sync Id's for the roots of the enabled datatypes. | 1029 // Sync Id's for the roots of the enabled datatypes. |
| 1030 std::map<ModelType, int64> type_roots_; | 1030 std::map<ModelType, int64> type_roots_; |
| 1031 FakeExtensionsActivityMonitor extensions_activity_monitor_; | 1031 FakeExtensionsActivityMonitor extensions_activity_monitor_; |
| 1032 | 1032 |
| 1033 protected: | 1033 protected: |
| 1034 FakeEncryptor encryptor_; | 1034 FakeEncryptor encryptor_; |
| 1035 TestUnrecoverableErrorHandler handler_; | 1035 TestUnrecoverableErrorHandler handler_; |
| 1036 FakeInvalidator* fake_invalidator_; | 1036 FakeInvalidator* fake_invalidator_; |
| 1037 SyncManagerImpl sync_manager_; | 1037 SyncManagerImpl sync_manager_; |
| 1038 WeakHandle<JsBackend> js_backend_; | 1038 WeakHandle<JsBackend> js_backend_; |
| (...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3006 | 3006 |
| 3007 // Verify only the non-disabled types remain after cleanup. | 3007 // Verify only the non-disabled types remain after cleanup. |
| 3008 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); | 3008 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); |
| 3009 EXPECT_TRUE(new_enabled_types.Equals( | 3009 EXPECT_TRUE(new_enabled_types.Equals( |
| 3010 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); | 3010 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); |
| 3011 EXPECT_TRUE(disabled_types.Equals( | 3011 EXPECT_TRUE(disabled_types.Equals( |
| 3012 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); | 3012 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); |
| 3013 } | 3013 } |
| 3014 | 3014 |
| 3015 } // namespace | 3015 } // namespace |
| OLD | NEW |