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

Side by Side Diff: chrome/browser/sync/test/integration/sync_extension_helper.cc

Issue 9369013: Take extensions out of Profile into a profile-keyed service, ExtensionSystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months 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 | Annotate | Revision Log
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 "chrome/browser/sync/test/integration/sync_extension_helper.h" 5 #include "chrome/browser/sync/test/integration/sync_extension_helper.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_system.h"
13 #include "chrome/browser/extensions/extension_system_factory.h"
12 #include "chrome/browser/extensions/pending_extension_info.h" 14 #include "chrome/browser/extensions/pending_extension_info.h"
13 #include "chrome/browser/extensions/pending_extension_manager.h" 15 #include "chrome/browser/extensions/pending_extension_manager.h"
14 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/extensions/extension_constants.h" 17 #include "chrome/common/extensions/extension_constants.h"
16 #include "chrome/common/string_ordinal.h" 18 #include "chrome/common/string_ordinal.h"
17 #include "chrome/browser/sync/test/integration/sync_test.h" 19 #include "chrome/browser/sync/test/integration/sync_test.h"
18 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" 20 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
19 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
20 22
21 SyncExtensionHelper::ExtensionState::ExtensionState() 23 SyncExtensionHelper::ExtensionState::ExtensionState()
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 << " do not match profile " << profile2->GetDebugName(); 230 << " do not match profile " << profile2->GetDebugName();
229 return false; 231 return false;
230 } 232 }
231 ++it1; 233 ++it1;
232 ++it2; 234 ++it2;
233 } 235 }
234 return true; 236 return true;
235 } 237 }
236 238
237 void SyncExtensionHelper::SetupProfile(Profile* profile) { 239 void SyncExtensionHelper::SetupProfile(Profile* profile) {
238 profile->InitExtensions(true); 240 ExtensionSystemFactory::GetForProfile(profile)->Init(true);
239 profile_extensions_.insert(make_pair(profile, ExtensionNameMap())); 241 profile_extensions_.insert(make_pair(profile, ExtensionNameMap()));
240 } 242 }
241 243
242 namespace { 244 namespace {
243 245
244 std::string NameToPublicKey(const std::string& name) { 246 std::string NameToPublicKey(const std::string& name) {
245 std::string public_key; 247 std::string public_key;
246 std::string pem; 248 std::string pem;
247 EXPECT_TRUE(Extension::ProducePEM(name, &pem) && 249 EXPECT_TRUE(Extension::ProducePEM(name, &pem) &&
248 Extension::FormatPEMForFileOutput(pem, &public_key, 250 Extension::FormatPEMForFileOutput(pem, &public_key,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 if (extension->id() != expected_id) { 341 if (extension->id() != expected_id) {
340 EXPECT_EQ(expected_id, extension->id()); 342 EXPECT_EQ(expected_id, extension->id());
341 return NULL; 343 return NULL;
342 } 344 }
343 DVLOG(2) << "created extension with name = " 345 DVLOG(2) << "created extension with name = "
344 << name << ", id = " << expected_id; 346 << name << ", id = " << expected_id;
345 (it->second)[name] = extension; 347 (it->second)[name] = extension;
346 id_to_name_[expected_id] = name; 348 id_to_name_[expected_id] = name;
347 return extension; 349 return extension;
348 } 350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698