| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 private: | 188 private: |
| 189 // SettingsStorageFactory is refcounted. | 189 // SettingsStorageFactory is refcounted. |
| 190 virtual ~TestingValueStoreFactory() {} | 190 virtual ~TestingValueStoreFactory() {} |
| 191 | 191 |
| 192 // None of these storage areas are owned by this factory, so care must be | 192 // None of these storage areas are owned by this factory, so care must be |
| 193 // taken when calling GetExisting. | 193 // taken when calling GetExisting. |
| 194 std::map<std::string, TestingValueStore*> created_; | 194 std::map<std::string, TestingValueStore*> created_; |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 void AssignSettingsService(syncer::SyncableService** dst, | |
| 198 const SettingsFrontend* frontend, | |
| 199 syncer::ModelType type) { | |
| 200 *dst = frontend->GetBackendForSync(type); | |
| 201 } | |
| 202 | |
| 203 } // namespace | 197 } // namespace |
| 204 | 198 |
| 205 class ExtensionSettingsSyncTest : public testing::Test { | 199 class ExtensionSettingsSyncTest : public testing::Test { |
| 206 public: | 200 public: |
| 207 ExtensionSettingsSyncTest() | 201 ExtensionSettingsSyncTest() |
| 208 : ui_thread_(BrowserThread::UI, MessageLoop::current()), | 202 : ui_thread_(BrowserThread::UI, MessageLoop::current()), |
| 209 file_thread_(BrowserThread::FILE, MessageLoop::current()), | 203 file_thread_(BrowserThread::FILE, MessageLoop::current()), |
| 210 storage_factory_(new util::ScopedSettingsStorageFactory()), | 204 storage_factory_(new util::ScopedSettingsStorageFactory()), |
| 211 sync_processor_(new MockSyncChangeProcessor), | 205 sync_processor_(new MockSyncChangeProcessor), |
| 212 sync_processor_delegate_(new SyncChangeProcessorDelegate( | 206 sync_processor_delegate_(new SyncChangeProcessorDelegate( |
| (...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 ASSERT_EQ(1u, sync_processor_->changes().size()); | 1413 ASSERT_EQ(1u, sync_processor_->changes().size()); |
| 1420 SettingSyncData sync_data = sync_processor_->changes()[0]; | 1414 SettingSyncData sync_data = sync_processor_->changes()[0]; |
| 1421 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); | 1415 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); |
| 1422 EXPECT_EQ("ext", sync_data.extension_id()); | 1416 EXPECT_EQ("ext", sync_data.extension_id()); |
| 1423 EXPECT_EQ("key.with.spot", sync_data.key()); | 1417 EXPECT_EQ("key.with.spot", sync_data.key()); |
| 1424 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); | 1418 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); |
| 1425 } | 1419 } |
| 1426 } | 1420 } |
| 1427 | 1421 |
| 1428 } // namespace extensions | 1422 } // namespace extensions |
| OLD | NEW |