Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/extensions/settings/settings_sync_unittest.cc

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: replace missing extension_system include Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/scoped_temp_dir.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "chrome/browser/extensions/extension_system.h"
13 #include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" 14 #include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h"
14 #include "chrome/browser/extensions/settings/settings_frontend.h" 15 #include "chrome/browser/extensions/settings/settings_frontend.h"
15 #include "chrome/browser/extensions/settings/settings_storage_factory.h" 16 #include "chrome/browser/extensions/settings/settings_storage_factory.h"
16 #include "chrome/browser/extensions/settings/settings_sync_util.h" 17 #include "chrome/browser/extensions/settings/settings_sync_util.h"
17 #include "chrome/browser/extensions/settings/settings_test_util.h" 18 #include "chrome/browser/extensions/settings/settings_test_util.h"
18 #include "chrome/browser/extensions/settings/syncable_settings_storage.h" 19 #include "chrome/browser/extensions/settings/syncable_settings_storage.h"
20 #include "chrome/browser/extensions/test_extension_service.h"
19 #include "chrome/browser/value_store/testing_value_store.h" 21 #include "chrome/browser/value_store/testing_value_store.h"
20 #include "content/public/test/test_browser_thread.h" 22 #include "content/public/test/test_browser_thread.h"
21 #include "sync/api/sync_change_processor.h" 23 #include "sync/api/sync_change_processor.h"
22 #include "sync/api/sync_error_factory.h" 24 #include "sync/api/sync_error_factory.h"
23 #include "sync/api/sync_error_factory_mock.h" 25 #include "sync/api/sync_error_factory_mock.h"
24 26
25 using content::BrowserThread; 27 using content::BrowserThread;
26 28
27 namespace extensions { 29 namespace extensions {
28 30
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 profile_.reset(); 220 profile_.reset();
219 // Execute any pending deletion tasks. 221 // Execute any pending deletion tasks.
220 message_loop_.RunUntilIdle(); 222 message_loop_.RunUntilIdle();
221 } 223 }
222 224
223 protected: 225 protected:
224 // Adds a record of an extension or app to the extension service, then returns 226 // Adds a record of an extension or app to the extension service, then returns
225 // its storage area. 227 // its storage area.
226 ValueStore* AddExtensionAndGetStorage( 228 ValueStore* AddExtensionAndGetStorage(
227 const std::string& id, Extension::Type type) { 229 const std::string& id, Extension::Type type) {
228 profile_->GetMockExtensionService()->AddExtensionWithId(id, type); 230 ExtensionServiceInterface* esi =
231 extensions::ExtensionSystem::Get(profile_.get())->extension_service();
232 static_cast<extensions::settings_test_util::MockExtensionService*>(esi)->
233 AddExtensionWithId(id, type);
229 return util::GetStorage(id, frontend_.get()); 234 return util::GetStorage(id, frontend_.get());
230 } 235 }
231 236
232 // Gets the syncer::SyncableService for the given sync type. 237 // Gets the syncer::SyncableService for the given sync type.
233 syncer::SyncableService* GetSyncableService(syncer::ModelType model_type) { 238 syncer::SyncableService* GetSyncableService(syncer::ModelType model_type) {
234 MessageLoop::current()->RunUntilIdle(); 239 MessageLoop::current()->RunUntilIdle();
235 return frontend_->GetBackendForSync(model_type); 240 return frontend_->GetBackendForSync(model_type);
236 } 241 }
237 242
238 // Gets all the sync data from the SyncableService for a sync type as a map 243 // Gets all the sync data from the SyncableService for a sync type as a map
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 ASSERT_EQ(1u, sync_processor_->changes().size()); 1417 ASSERT_EQ(1u, sync_processor_->changes().size());
1413 SettingSyncData sync_data = sync_processor_->changes()[0]; 1418 SettingSyncData sync_data = sync_processor_->changes()[0];
1414 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); 1419 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type());
1415 EXPECT_EQ("ext", sync_data.extension_id()); 1420 EXPECT_EQ("ext", sync_data.extension_id());
1416 EXPECT_EQ("key.with.spot", sync_data.key()); 1421 EXPECT_EQ("key.with.spot", sync_data.key());
1417 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); 1422 EXPECT_TRUE(sync_data.value().Equals(string_value.get()));
1418 } 1423 }
1419 } 1424 }
1420 1425
1421 } // namespace extensions 1426 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698