| 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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 // SettingsStorageFactory implementation. | 170 // SettingsStorageFactory implementation. |
| 171 virtual ValueStore* Create(const base::FilePath& base_path, | 171 virtual ValueStore* Create(const base::FilePath& base_path, |
| 172 const std::string& extension_id) OVERRIDE { | 172 const std::string& extension_id) OVERRIDE { |
| 173 TestingValueStore* new_storage = new TestingValueStore(); | 173 TestingValueStore* new_storage = new TestingValueStore(); |
| 174 DCHECK(!created_.count(extension_id)); | 174 DCHECK(!created_.count(extension_id)); |
| 175 created_[extension_id] = new_storage; | 175 created_[extension_id] = new_storage; |
| 176 return new_storage; | 176 return new_storage; |
| 177 } | 177 } |
| 178 | 178 |
| 179 // Testing value stores don't actually create a real database. Don't delete | |
| 180 // any files. | |
| 181 virtual void DeleteDatabaseIfExists( | |
| 182 const base::FilePath& base_path, | |
| 183 const std::string& extension_id) OVERRIDE {} | |
| 184 | |
| 185 private: | 179 private: |
| 186 // SettingsStorageFactory is refcounted. | 180 // SettingsStorageFactory is refcounted. |
| 187 virtual ~TestingValueStoreFactory() {} | 181 virtual ~TestingValueStoreFactory() {} |
| 188 | 182 |
| 189 // None of these storage areas are owned by this factory, so care must be | 183 // None of these storage areas are owned by this factory, so care must be |
| 190 // taken when calling GetExisting. | 184 // taken when calling GetExisting. |
| 191 std::map<std::string, TestingValueStore*> created_; | 185 std::map<std::string, TestingValueStore*> created_; |
| 192 }; | 186 }; |
| 193 | 187 |
| 194 } // namespace | 188 } // namespace |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 ASSERT_EQ(1u, sync_processor_->changes().size()); | 1411 ASSERT_EQ(1u, sync_processor_->changes().size()); |
| 1418 SettingSyncData sync_data = sync_processor_->changes()[0]; | 1412 SettingSyncData sync_data = sync_processor_->changes()[0]; |
| 1419 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); | 1413 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); |
| 1420 EXPECT_EQ("ext", sync_data.extension_id()); | 1414 EXPECT_EQ("ext", sync_data.extension_id()); |
| 1421 EXPECT_EQ("key.with.spot", sync_data.key()); | 1415 EXPECT_EQ("key.with.spot", sync_data.key()); |
| 1422 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); | 1416 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); |
| 1423 } | 1417 } |
| 1424 } | 1418 } |
| 1425 | 1419 |
| 1426 } // namespace extensions | 1420 } // namespace extensions |
| OLD | NEW |