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 |
179 private: | 185 private: |
180 // SettingsStorageFactory is refcounted. | 186 // SettingsStorageFactory is refcounted. |
181 virtual ~TestingValueStoreFactory() {} | 187 virtual ~TestingValueStoreFactory() {} |
182 | 188 |
183 // None of these storage areas are owned by this factory, so care must be | 189 // None of these storage areas are owned by this factory, so care must be |
184 // taken when calling GetExisting. | 190 // taken when calling GetExisting. |
185 std::map<std::string, TestingValueStore*> created_; | 191 std::map<std::string, TestingValueStore*> created_; |
186 }; | 192 }; |
187 | 193 |
188 } // namespace | 194 } // namespace |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 ASSERT_EQ(1u, sync_processor_->changes().size()); | 1417 ASSERT_EQ(1u, sync_processor_->changes().size()); |
1412 SettingSyncData sync_data = sync_processor_->changes()[0]; | 1418 SettingSyncData sync_data = sync_processor_->changes()[0]; |
1413 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); | 1419 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); |
1414 EXPECT_EQ("ext", sync_data.extension_id()); | 1420 EXPECT_EQ("ext", sync_data.extension_id()); |
1415 EXPECT_EQ("key.with.spot", sync_data.key()); | 1421 EXPECT_EQ("key.with.spot", sync_data.key()); |
1416 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); | 1422 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); |
1417 } | 1423 } |
1418 } | 1424 } |
1419 | 1425 |
1420 } // namespace extensions | 1426 } // namespace extensions |
OLD | NEW |