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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 // SettingsStorageFactory implementation. | 196 // SettingsStorageFactory implementation. |
197 virtual ValueStore* Create(const base::FilePath& base_path, | 197 virtual ValueStore* Create(const base::FilePath& base_path, |
198 const std::string& extension_id) OVERRIDE { | 198 const std::string& extension_id) OVERRIDE { |
199 TestingValueStore* new_storage = new TestingValueStore(); | 199 TestingValueStore* new_storage = new TestingValueStore(); |
200 DCHECK(!created_.count(extension_id)); | 200 DCHECK(!created_.count(extension_id)); |
201 created_[extension_id] = new_storage; | 201 created_[extension_id] = new_storage; |
202 return new_storage; | 202 return new_storage; |
203 } | 203 } |
204 | 204 |
| 205 virtual base::FilePath GetDatabasePath( |
| 206 const base::FilePath& base_path, |
| 207 const std::string& extension_id) OVERRIDE { |
| 208 return base_path.AppendASCII(extension_id); |
| 209 } |
| 210 |
205 private: | 211 private: |
206 // SettingsStorageFactory is refcounted. | 212 // SettingsStorageFactory is refcounted. |
207 virtual ~TestingValueStoreFactory() {} | 213 virtual ~TestingValueStoreFactory() {} |
208 | 214 |
209 // None of these storage areas are owned by this factory, so care must be | 215 // None of these storage areas are owned by this factory, so care must be |
210 // taken when calling GetExisting. | 216 // taken when calling GetExisting. |
211 std::map<std::string, TestingValueStore*> created_; | 217 std::map<std::string, TestingValueStore*> created_; |
212 }; | 218 }; |
213 | 219 |
214 } // namespace | 220 } // namespace |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 ASSERT_EQ(1u, sync_processor_->changes().size()); | 1439 ASSERT_EQ(1u, sync_processor_->changes().size()); |
1434 SettingSyncData sync_data = sync_processor_->changes()[0]; | 1440 SettingSyncData sync_data = sync_processor_->changes()[0]; |
1435 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); | 1441 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); |
1436 EXPECT_EQ("ext", sync_data.extension_id()); | 1442 EXPECT_EQ("ext", sync_data.extension_id()); |
1437 EXPECT_EQ("key.with.spot", sync_data.key()); | 1443 EXPECT_EQ("key.with.spot", sync_data.key()); |
1438 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); | 1444 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); |
1439 } | 1445 } |
1440 } | 1446 } |
1441 | 1447 |
1442 } // namespace extensions | 1448 } // namespace extensions |
OLD | NEW |