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

Side by Side Diff: components/reading_list/ios/reading_list_model_unittest.mm

Issue 2618483003: [Sync] Introduce ModelError for USS error handling. (Closed)
Patch Set: Address comments. 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 "components/reading_list/ios/reading_list_model.h" 5 #include "components/reading_list/ios/reading_list_model.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #import "base/test/ios/wait_util.h" 9 #import "base/test/ios/wait_util.h"
10 #include "components/reading_list/ios/reading_list_model_impl.h" 10 #include "components/reading_list/ios/reading_list_model_impl.h"
11 #include "components/reading_list/ios/reading_list_model_storage.h" 11 #include "components/reading_list/ios/reading_list_model_storage.h"
12 #include "components/reading_list/ios/reading_list_store_delegate.h" 12 #include "components/reading_list/ios/reading_list_store_delegate.h"
13 #include "components/sync/model/metadata_change_list.h" 13 #include "components/sync/model/metadata_change_list.h"
14 #include "components/sync/model/model_error.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace { 17 namespace {
17 18
18 const GURL callback_url("http://example.com"); 19 const GURL callback_url("http://example.com");
19 const std::string callback_title("test title"); 20 const std::string callback_title("test title");
20 21
21 class TestReadingListStorageObserver { 22 class TestReadingListStorageObserver {
22 public: 23 public:
23 virtual void ReadingListDidSaveEntry() = 0; 24 virtual void ReadingListDidSaveEntry() = 0;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return std::unique_ptr<ScopedBatchUpdate>(); 103 return std::unique_ptr<ScopedBatchUpdate>();
103 } 104 }
104 105
105 // Syncing is not used in this test class. 106 // Syncing is not used in this test class.
106 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList() 107 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
107 override { 108 override {
108 NOTREACHED(); 109 NOTREACHED();
109 return std::unique_ptr<syncer::MetadataChangeList>(); 110 return std::unique_ptr<syncer::MetadataChangeList>();
110 } 111 }
111 112
112 syncer::SyncError MergeSyncData( 113 syncer::ModelError MergeSyncData(
113 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, 114 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
114 syncer::EntityDataMap entity_data_map) override { 115 syncer::EntityDataMap entity_data_map) override {
115 NOTREACHED(); 116 NOTREACHED();
116 return syncer::SyncError(); 117 return syncer::ModelError();
117 } 118 }
118 119
119 syncer::SyncError ApplySyncChanges( 120 syncer::ModelError ApplySyncChanges(
120 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, 121 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
121 syncer::EntityChangeList entity_changes) override { 122 syncer::EntityChangeList entity_changes) override {
122 NOTREACHED(); 123 NOTREACHED();
123 return syncer::SyncError(); 124 return syncer::ModelError();
124 } 125 }
125 126
126 void GetData(StorageKeyList storage_keys, DataCallback callback) override { 127 void GetData(StorageKeyList storage_keys, DataCallback callback) override {
127 NOTREACHED(); 128 NOTREACHED();
128 return; 129 return;
129 } 130 }
130 131
131 void GetAllData(DataCallback callback) override { 132 void GetAllData(DataCallback callback) override {
132 NOTREACHED(); 133 NOTREACHED();
133 return; 134 return;
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 } 637 }
637 638
638 // Tests that ReadingListModel calls CallbackModelBeingDeleted when destroyed. 639 // Tests that ReadingListModel calls CallbackModelBeingDeleted when destroyed.
639 TEST_F(ReadingListModelTest, CallbackModelBeingDeleted) { 640 TEST_F(ReadingListModelTest, CallbackModelBeingDeleted) {
640 AssertObserverCount(1, 0, 0, 0, 0, 0, 0, 0, 0); 641 AssertObserverCount(1, 0, 0, 0, 0, 0, 0, 0, 0);
641 model_.reset(); 642 model_.reset();
642 AssertObserverCount(1, 0, 0, 1, 0, 0, 0, 0, 0); 643 AssertObserverCount(1, 0, 0, 1, 0, 0, 0, 0, 0);
643 } 644 }
644 645
645 } // namespace 646 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698