| 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/files/scoped_temp_dir.h" |
| 8 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 12 #include "base/scoped_temp_dir.h" | |
| 13 #include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" | 13 #include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" |
| 14 #include "chrome/browser/extensions/settings/settings_frontend.h" | 14 #include "chrome/browser/extensions/settings/settings_frontend.h" |
| 15 #include "chrome/browser/extensions/settings/settings_storage_factory.h" | 15 #include "chrome/browser/extensions/settings/settings_storage_factory.h" |
| 16 #include "chrome/browser/extensions/settings/settings_sync_util.h" | 16 #include "chrome/browser/extensions/settings/settings_sync_util.h" |
| 17 #include "chrome/browser/extensions/settings/settings_test_util.h" | 17 #include "chrome/browser/extensions/settings/settings_test_util.h" |
| 18 #include "chrome/browser/extensions/settings/syncable_settings_storage.h" | 18 #include "chrome/browser/extensions/settings/syncable_settings_storage.h" |
| 19 #include "chrome/browser/value_store/testing_value_store.h" | 19 #include "chrome/browser/value_store/testing_value_store.h" |
| 20 #include "content/public/test/test_browser_thread.h" | 20 #include "content/public/test/test_browser_thread.h" |
| 21 #include "sync/api/sync_change_processor.h" | 21 #include "sync/api/sync_change_processor.h" |
| 22 #include "sync/api/sync_error_factory.h" | 22 #include "sync/api/sync_error_factory.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 as_map[sync_data.extension_id()].push_back(sync_data); | 248 as_map[sync_data.extension_id()].push_back(sync_data); |
| 249 } | 249 } |
| 250 return as_map; | 250 return as_map; |
| 251 } | 251 } |
| 252 | 252 |
| 253 // Need these so that the DCHECKs for running on FILE or UI threads pass. | 253 // Need these so that the DCHECKs for running on FILE or UI threads pass. |
| 254 MessageLoop message_loop_; | 254 MessageLoop message_loop_; |
| 255 content::TestBrowserThread ui_thread_; | 255 content::TestBrowserThread ui_thread_; |
| 256 content::TestBrowserThread file_thread_; | 256 content::TestBrowserThread file_thread_; |
| 257 | 257 |
| 258 ScopedTempDir temp_dir_; | 258 base::ScopedTempDir temp_dir_; |
| 259 scoped_ptr<util::MockProfile> profile_; | 259 scoped_ptr<util::MockProfile> profile_; |
| 260 scoped_ptr<SettingsFrontend> frontend_; | 260 scoped_ptr<SettingsFrontend> frontend_; |
| 261 scoped_refptr<util::ScopedSettingsStorageFactory> storage_factory_; | 261 scoped_refptr<util::ScopedSettingsStorageFactory> storage_factory_; |
| 262 scoped_ptr<MockSyncChangeProcessor> sync_processor_; | 262 scoped_ptr<MockSyncChangeProcessor> sync_processor_; |
| 263 scoped_ptr<SyncChangeProcessorDelegate> sync_processor_delegate_; | 263 scoped_ptr<SyncChangeProcessorDelegate> sync_processor_delegate_; |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 // Get a semblance of coverage for both EXTENSION_SETTINGS and APP_SETTINGS | 266 // Get a semblance of coverage for both EXTENSION_SETTINGS and APP_SETTINGS |
| 267 // sync by roughly alternative which one to test. | 267 // sync by roughly alternative which one to test. |
| 268 | 268 |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 ASSERT_EQ(1u, sync_processor_->changes().size()); | 1412 ASSERT_EQ(1u, sync_processor_->changes().size()); |
| 1413 SettingSyncData sync_data = sync_processor_->changes()[0]; | 1413 SettingSyncData sync_data = sync_processor_->changes()[0]; |
| 1414 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); | 1414 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); |
| 1415 EXPECT_EQ("ext", sync_data.extension_id()); | 1415 EXPECT_EQ("ext", sync_data.extension_id()); |
| 1416 EXPECT_EQ("key.with.spot", sync_data.key()); | 1416 EXPECT_EQ("key.with.spot", sync_data.key()); |
| 1417 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); | 1417 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); |
| 1418 } | 1418 } |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 } // namespace extensions | 1421 } // namespace extensions |
| OLD | NEW |