Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: components/sync/core_impl/sync_manager_impl_unittest.cc

Issue 2276943006: [USS] Move GetAllNodes from backend to controller (Closed)
Patch Set: update for Max Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "components/sync/core_impl/sync_manager_impl.h" 9 #include "components/sync/core_impl/sync_manager_impl.h"
10 10
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 CancelationSignal cancelation_signal_; 1186 CancelationSignal cancelation_signal_;
1187 WeakHandle<JsBackend> js_backend_; 1187 WeakHandle<JsBackend> js_backend_;
1188 bool initialization_succeeded_; 1188 bool initialization_succeeded_;
1189 StrictMock<SyncManagerObserverMock> manager_observer_; 1189 StrictMock<SyncManagerObserverMock> manager_observer_;
1190 StrictMock<SyncEncryptionHandlerObserverMock> encryption_observer_; 1190 StrictMock<SyncEncryptionHandlerObserverMock> encryption_observer_;
1191 InternalComponentsFactory::Switches switches_; 1191 InternalComponentsFactory::Switches switches_;
1192 InternalComponentsFactory::StorageOption storage_used_; 1192 InternalComponentsFactory::StorageOption storage_used_;
1193 MockUnrecoverableErrorHandler mock_unrecoverable_error_handler_; 1193 MockUnrecoverableErrorHandler mock_unrecoverable_error_handler_;
1194 }; 1194 };
1195 1195
1196 TEST_F(SyncManagerTest, GetAllNodesForTypeTest) {
1197 ModelSafeRoutingInfo routing_info;
1198 GetModelSafeRoutingInfo(&routing_info);
1199 sync_manager_.StartSyncingNormally(routing_info, base::Time());
1200
1201 std::unique_ptr<base::ListValue> node_list(
1202 sync_manager_.GetAllNodesForType(syncer::PREFERENCES));
1203
1204 // Should have one node: the type root node.
1205 ASSERT_EQ(1U, node_list->GetSize());
1206
1207 const base::DictionaryValue* first_result;
1208 ASSERT_TRUE(node_list->GetDictionary(0, &first_result));
1209 EXPECT_TRUE(first_result->HasKey("ID"));
1210 EXPECT_TRUE(first_result->HasKey("NON_UNIQUE_NAME"));
1211 }
1212
1213 TEST_F(SyncManagerTest, RefreshEncryptionReady) { 1196 TEST_F(SyncManagerTest, RefreshEncryptionReady) {
1214 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); 1197 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION));
1215 EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); 1198 EXPECT_CALL(encryption_observer_, OnEncryptionComplete());
1216 EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_)); 1199 EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_));
1217 EXPECT_CALL(encryption_observer_, OnEncryptedTypesChanged(_, false)); 1200 EXPECT_CALL(encryption_observer_, OnEncryptedTypesChanged(_, false));
1218 1201
1219 sync_manager_.GetEncryptionHandler()->Init(); 1202 sync_manager_.GetEncryptionHandler()->Init();
1220 PumpLoop(); 1203 PumpLoop();
1221 1204
1222 const ModelTypeSet encrypted_types = GetEncryptedTypes(); 1205 const ModelTypeSet encrypted_types = GetEncryptedTypes();
(...skipping 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3340 // SyncManagerInitInvalidStorageTest::GetFactory will return 3323 // SyncManagerInitInvalidStorageTest::GetFactory will return
3341 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. 3324 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails.
3342 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's 3325 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's
3343 // task is to ensure that SyncManagerImpl reported initialization failure in 3326 // task is to ensure that SyncManagerImpl reported initialization failure in
3344 // OnInitializationComplete callback. 3327 // OnInitializationComplete callback.
3345 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { 3328 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) {
3346 EXPECT_FALSE(initialization_succeeded_); 3329 EXPECT_FALSE(initialization_succeeded_);
3347 } 3330 }
3348 3331
3349 } // namespace syncer 3332 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/core_impl/sync_manager_impl.cc ('k') | components/sync/core_impl/test/fake_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698