| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 SettingSyncDataList matching_changes; | 123 SettingSyncDataList matching_changes; |
| 124 for (SettingSyncDataList::iterator it = changes_.begin(); | 124 for (SettingSyncDataList::iterator it = changes_.begin(); |
| 125 it != changes_.end(); ++it) { | 125 it != changes_.end(); ++it) { |
| 126 if (it->extension_id() == extension_id && it->key() == key) { | 126 if (it->extension_id() == extension_id && it->key() == key) { |
| 127 matching_changes.push_back(*it); | 127 matching_changes.push_back(*it); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 if (matching_changes.empty()) { | 130 if (matching_changes.empty()) { |
| 131 ADD_FAILURE() << "No matching changes for " << extension_id << "/" << | 131 ADD_FAILURE() << "No matching changes for " << extension_id << "/" << |
| 132 key << " (out of " << changes_.size() << ")"; | 132 key << " (out of " << changes_.size() << ")"; |
| 133 return SettingSyncData( | 133 return SettingSyncData(syncer::SyncChange::ACTION_INVALID, |
| 134 syncer::SyncChange::ACTION_INVALID, "", "", | 134 std::string(), |
| 135 scoped_ptr<Value>(new DictionaryValue())); | 135 std::string(), |
| 136 scoped_ptr<Value>(new DictionaryValue())); |
| 136 } | 137 } |
| 137 if (matching_changes.size() != 1u) { | 138 if (matching_changes.size() != 1u) { |
| 138 ADD_FAILURE() << matching_changes.size() << " matching changes for " << | 139 ADD_FAILURE() << matching_changes.size() << " matching changes for " << |
| 139 extension_id << "/" << key << " (out of " << changes_.size() << ")"; | 140 extension_id << "/" << key << " (out of " << changes_.size() << ")"; |
| 140 } | 141 } |
| 141 return matching_changes[0]; | 142 return matching_changes[0]; |
| 142 } | 143 } |
| 143 | 144 |
| 144 private: | 145 private: |
| 145 SettingSyncDataList changes_; | 146 SettingSyncDataList changes_; |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 ASSERT_EQ(1u, sync_processor_->changes().size()); | 1418 ASSERT_EQ(1u, sync_processor_->changes().size()); |
| 1418 SettingSyncData sync_data = sync_processor_->changes()[0]; | 1419 SettingSyncData sync_data = sync_processor_->changes()[0]; |
| 1419 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); | 1420 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); |
| 1420 EXPECT_EQ("ext", sync_data.extension_id()); | 1421 EXPECT_EQ("ext", sync_data.extension_id()); |
| 1421 EXPECT_EQ("key.with.spot", sync_data.key()); | 1422 EXPECT_EQ("key.with.spot", sync_data.key()); |
| 1422 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); | 1423 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); |
| 1423 } | 1424 } |
| 1424 } | 1425 } |
| 1425 | 1426 |
| 1426 } // namespace extensions | 1427 } // namespace extensions |
| OLD | NEW |