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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 public: | 90 public: |
91 MockSyncChangeProcessor() : fail_all_requests_(false) {} | 91 MockSyncChangeProcessor() : fail_all_requests_(false) {} |
92 | 92 |
93 // syncer::SyncChangeProcessor implementation. | 93 // syncer::SyncChangeProcessor implementation. |
94 virtual syncer::SyncError ProcessSyncChanges( | 94 virtual syncer::SyncError ProcessSyncChanges( |
95 const tracked_objects::Location& from_here, | 95 const tracked_objects::Location& from_here, |
96 const syncer::SyncChangeList& change_list) OVERRIDE { | 96 const syncer::SyncChangeList& change_list) OVERRIDE { |
97 if (fail_all_requests_) { | 97 if (fail_all_requests_) { |
98 return syncer::SyncError( | 98 return syncer::SyncError( |
99 FROM_HERE, | 99 FROM_HERE, |
| 100 syncer::SyncError::DATATYPE_ERROR, |
100 "MockSyncChangeProcessor: configured to fail", | 101 "MockSyncChangeProcessor: configured to fail", |
101 change_list[0].sync_data().GetDataType()); | 102 change_list[0].sync_data().GetDataType()); |
102 } | 103 } |
103 for (syncer::SyncChangeList::const_iterator it = change_list.begin(); | 104 for (syncer::SyncChangeList::const_iterator it = change_list.begin(); |
104 it != change_list.end(); ++it) { | 105 it != change_list.end(); ++it) { |
105 changes_.push_back(SettingSyncData(*it)); | 106 changes_.push_back(SettingSyncData(*it)); |
106 } | 107 } |
107 return syncer::SyncError(); | 108 return syncer::SyncError(); |
108 } | 109 } |
109 | 110 |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 ASSERT_EQ(1u, sync_processor_->changes().size()); | 1422 ASSERT_EQ(1u, sync_processor_->changes().size()); |
1422 SettingSyncData sync_data = sync_processor_->changes()[0]; | 1423 SettingSyncData sync_data = sync_processor_->changes()[0]; |
1423 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); | 1424 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); |
1424 EXPECT_EQ("ext", sync_data.extension_id()); | 1425 EXPECT_EQ("ext", sync_data.extension_id()); |
1425 EXPECT_EQ("key.with.spot", sync_data.key()); | 1426 EXPECT_EQ("key.with.spot", sync_data.key()); |
1426 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); | 1427 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); |
1427 } | 1428 } |
1428 } | 1429 } |
1429 | 1430 |
1430 } // namespace extensions | 1431 } // namespace extensions |
OLD | NEW |