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

Side by Side Diff: chrome/browser/sync/test/integration/two_client_uss_sync_test.cc

Issue 2412193002: [Sync] Move SharedModelTypeProcessor to model_impl/. (Closed)
Patch Set: Address comment from Sky. Created 4 years, 2 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
« no previous file with comments | « no previous file | components/browser_sync/profile_sync_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/memory/ptr_util.h" 6 #include "base/memory/ptr_util.h"
7 #include "base/threading/thread_task_runner_handle.h" 7 #include "base/threading/thread_task_runner_handle.h"
8 #include "chrome/browser/sync/chrome_sync_client.h" 8 #include "chrome/browser/sync/chrome_sync_client.h"
9 #include "chrome/browser/sync/profile_sync_service_factory.h" 9 #include "chrome/browser/sync/profile_sync_service_factory.h"
10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
11 #include "chrome/browser/sync/test/integration/single_client_status_change_check er.h" 11 #include "chrome/browser/sync/test/integration/single_client_status_change_check er.h"
12 #include "chrome/browser/sync/test/integration/status_change_checker.h" 12 #include "chrome/browser/sync/test/integration/status_change_checker.h"
13 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 13 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
14 #include "chrome/browser/sync/test/integration/sync_test.h" 14 #include "chrome/browser/sync/test/integration/sync_test.h"
15 #include "components/browser_sync/profile_sync_components_factory_impl.h" 15 #include "components/browser_sync/profile_sync_components_factory_impl.h"
16 #include "components/browser_sync/profile_sync_service.h" 16 #include "components/browser_sync/profile_sync_service.h"
17 #include "components/sync/model/fake_model_type_service.h" 17 #include "components/sync/model/fake_model_type_service.h"
18 #include "components/sync/model/metadata_change_list.h"
19 #include "components/sync/model/model_type_change_processor.h"
18 20
19 using browser_sync::ChromeSyncClient; 21 using browser_sync::ChromeSyncClient;
20 using browser_sync::ProfileSyncComponentsFactoryImpl; 22 using browser_sync::ProfileSyncComponentsFactoryImpl;
21 using syncer::ConflictResolution; 23 using syncer::ConflictResolution;
22 using syncer::FakeModelTypeService; 24 using syncer::FakeModelTypeService;
25 using syncer::ModelTypeChangeProcessor;
23 using syncer::ModelTypeService; 26 using syncer::ModelTypeService;
24 using syncer::SharedModelTypeProcessor;
25 27
26 const char kKey1[] = "key1"; 28 const char kKey1[] = "key1";
27 const char kKey2[] = "key2"; 29 const char kKey2[] = "key2";
28 const char kValue1[] = "value1"; 30 const char kValue1[] = "value1";
29 const char kValue2[] = "value2"; 31 const char kValue2[] = "value2";
30 const char kValue3[] = "value3"; 32 const char kValue3[] = "value3";
31 33
32 // A ChromeSyncClient that provides a ModelTypeService for PREFERENCES. 34 // A ChromeSyncClient that provides a ModelTypeService for PREFERENCES.
33 class TestSyncClient : public ChromeSyncClient { 35 class TestSyncClient : public ChromeSyncClient {
34 public: 36 public:
(...skipping 13 matching lines...) Expand all
48 50
49 // A FakeModelTypeService that supports observing ApplySyncChanges. 51 // A FakeModelTypeService that supports observing ApplySyncChanges.
50 class TestModelTypeService : public FakeModelTypeService { 52 class TestModelTypeService : public FakeModelTypeService {
51 public: 53 public:
52 class Observer { 54 class Observer {
53 public: 55 public:
54 virtual void OnApplySyncChanges() = 0; 56 virtual void OnApplySyncChanges() = 0;
55 }; 57 };
56 58
57 TestModelTypeService() 59 TestModelTypeService()
58 : FakeModelTypeService( 60 : FakeModelTypeService(base::Bind(&ModelTypeChangeProcessor::Create)) {}
59 base::Bind(&SharedModelTypeProcessor::CreateAsChangeProcessor)) {}
60 61
61 syncer::SyncError ApplySyncChanges( 62 syncer::SyncError ApplySyncChanges(
62 std::unique_ptr<syncer::MetadataChangeList> metadata_changes, 63 std::unique_ptr<syncer::MetadataChangeList> metadata_changes,
63 syncer::EntityChangeList entity_changes) override { 64 syncer::EntityChangeList entity_changes) override {
64 syncer::SyncError error = FakeModelTypeService::ApplySyncChanges( 65 syncer::SyncError error = FakeModelTypeService::ApplySyncChanges(
65 std::move(metadata_changes), entity_changes); 66 std::move(metadata_changes), entity_changes);
66 NotifyObservers(); 67 NotifyObservers();
67 return error; 68 return error;
68 } 69 }
69 70
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 model2->SetServiceError(syncer::SyncError::DATATYPE_ERROR); 320 model2->SetServiceError(syncer::SyncError::DATATYPE_ERROR);
320 // Write an item on model 1 to trigger a GetUpdates in model 2. 321 // Write an item on model 1 to trigger a GetUpdates in model 2.
321 model1->WriteItem(kKey1, kValue2); 322 model1->WriteItem(kKey1, kValue2);
322 323
323 // The type should stop syncing but keep tracking metadata. 324 // The type should stop syncing but keep tracking metadata.
324 ASSERT_TRUE(PrefsNotRunningChecker(GetSyncService(1)).Wait()); 325 ASSERT_TRUE(PrefsNotRunningChecker(GetSyncService(1)).Wait());
325 ASSERT_EQ(1U, model2->db().metadata_count()); 326 ASSERT_EQ(1U, model2->db().metadata_count());
326 model2->WriteItem(kKey2, kValue2); 327 model2->WriteItem(kKey2, kValue2);
327 ASSERT_EQ(2U, model2->db().metadata_count()); 328 ASSERT_EQ(2U, model2->db().metadata_count());
328 } 329 }
OLDNEW
« no previous file with comments | « no previous file | components/browser_sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698