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

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

Issue 2623723002: [Sync] Remove ModelError::IsSet() in favor of base::Optional. (Closed)
Patch Set: Rebase. Created 3 years, 11 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 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/optional.h"
7 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
8 #include "chrome/browser/sync/chrome_sync_client.h" 9 #include "chrome/browser/sync/chrome_sync_client.h"
9 #include "chrome/browser/sync/profile_sync_service_factory.h" 10 #include "chrome/browser/sync/profile_sync_service_factory.h"
10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 11 #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" 12 #include "chrome/browser/sync/test/integration/single_client_status_change_check er.h"
12 #include "chrome/browser/sync/test/integration/status_change_checker.h" 13 #include "chrome/browser/sync/test/integration/status_change_checker.h"
13 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 14 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
14 #include "chrome/browser/sync/test/integration/sync_test.h" 15 #include "chrome/browser/sync/test/integration/sync_test.h"
15 #include "components/browser_sync/profile_sync_components_factory_impl.h" 16 #include "components/browser_sync/profile_sync_components_factory_impl.h"
16 #include "components/browser_sync/profile_sync_service.h" 17 #include "components/browser_sync/profile_sync_service.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 class Observer { 61 class Observer {
61 public: 62 public:
62 virtual void OnApplySyncChanges() = 0; 63 virtual void OnApplySyncChanges() = 0;
63 }; 64 };
64 65
65 TestModelTypeSyncBridge() 66 TestModelTypeSyncBridge()
66 : FakeModelTypeSyncBridge(base::Bind(&ModelTypeChangeProcessor::Create)) { 67 : FakeModelTypeSyncBridge(base::Bind(&ModelTypeChangeProcessor::Create)) {
67 change_processor()->OnMetadataLoaded(db().CreateMetadataBatch()); 68 change_processor()->OnMetadataLoaded(db().CreateMetadataBatch());
68 } 69 }
69 70
70 syncer::ModelError ApplySyncChanges( 71 base::Optional<syncer::ModelError> ApplySyncChanges(
71 std::unique_ptr<syncer::MetadataChangeList> metadata_changes, 72 std::unique_ptr<syncer::MetadataChangeList> metadata_changes,
72 syncer::EntityChangeList entity_changes) override { 73 syncer::EntityChangeList entity_changes) override {
73 syncer::ModelError error = FakeModelTypeSyncBridge::ApplySyncChanges( 74 auto error = FakeModelTypeSyncBridge::ApplySyncChanges(
74 std::move(metadata_changes), entity_changes); 75 std::move(metadata_changes), entity_changes);
75 NotifyObservers(); 76 NotifyObservers();
76 return error; 77 return error;
77 } 78 }
78 79
79 void AddObserver(Observer* observer) { observers_.insert(observer); } 80 void AddObserver(Observer* observer) { observers_.insert(observer); }
80 void RemoveObserver(Observer* observer) { observers_.erase(observer); } 81 void RemoveObserver(Observer* observer) { observers_.erase(observer); }
81 82
82 private: 83 private:
83 void NotifyObservers() { 84 void NotifyObservers() {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 362
362 ASSERT_TRUE(DataChecker(model1, kKey1, kValue2).Wait()); 363 ASSERT_TRUE(DataChecker(model1, kKey1, kValue2).Wait());
363 ASSERT_TRUE(DataChecker(model1, kKey2, kValue1).Wait()); 364 ASSERT_TRUE(DataChecker(model1, kKey2, kValue1).Wait());
364 ASSERT_TRUE(DataChecker(model1, kKey4, kValue1).Wait()); 365 ASSERT_TRUE(DataChecker(model1, kKey4, kValue1).Wait());
365 366
366 ASSERT_TRUE(DataChecker(model0, kKey1, kValue2).Wait()); 367 ASSERT_TRUE(DataChecker(model0, kKey1, kValue2).Wait());
367 ASSERT_TRUE(DataChecker(model0, kKey3, kValue1).Wait()); 368 ASSERT_TRUE(DataChecker(model0, kKey3, kValue1).Wait());
368 } 369 }
369 370
370 } // namespace 371 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698