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 "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.h" | 17 #include "chrome/common/extensions/extension.h" |
16 #include "chrome/common/extensions/extension_constants.h" | 18 #include "chrome/common/extensions/extension_constants.h" |
17 #include "chrome/common/string_ordinal.h" | 19 #include "chrome/common/string_ordinal.h" |
18 #include "chrome/browser/sync/test/integration/sync_test.h" | 20 #include "chrome/browser/sync/test/integration/sync_test.h" |
19 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 21 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
21 | 23 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 << " do not match profile " << profile2->GetDebugName(); | 234 << " do not match profile " << profile2->GetDebugName(); |
233 return false; | 235 return false; |
234 } | 236 } |
235 ++it1; | 237 ++it1; |
236 ++it2; | 238 ++it2; |
237 } | 239 } |
238 return true; | 240 return true; |
239 } | 241 } |
240 | 242 |
241 void SyncExtensionHelper::SetupProfile(Profile* profile) { | 243 void SyncExtensionHelper::SetupProfile(Profile* profile) { |
242 profile->InitExtensions(true); | 244 ExtensionSystemFactory::GetForProfile(profile)->Init(true); |
243 profile_extensions_.insert(make_pair(profile, ExtensionNameMap())); | 245 profile_extensions_.insert(make_pair(profile, ExtensionNameMap())); |
244 } | 246 } |
245 | 247 |
246 namespace { | 248 namespace { |
247 | 249 |
248 std::string NameToPublicKey(const std::string& name) { | 250 std::string NameToPublicKey(const std::string& name) { |
249 std::string public_key; | 251 std::string public_key; |
250 std::string pem; | 252 std::string pem; |
251 EXPECT_TRUE(Extension::ProducePEM(name, &pem) && | 253 EXPECT_TRUE(Extension::ProducePEM(name, &pem) && |
252 Extension::FormatPEMForFileOutput(pem, &public_key, | 254 Extension::FormatPEMForFileOutput(pem, &public_key, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 if (extension->id() != expected_id) { | 345 if (extension->id() != expected_id) { |
344 EXPECT_EQ(expected_id, extension->id()); | 346 EXPECT_EQ(expected_id, extension->id()); |
345 return NULL; | 347 return NULL; |
346 } | 348 } |
347 DVLOG(2) << "created extension with name = " | 349 DVLOG(2) << "created extension with name = " |
348 << name << ", id = " << expected_id; | 350 << name << ", id = " << expected_id; |
349 (it->second)[name] = extension; | 351 (it->second)[name] = extension; |
350 id_to_name_[expected_id] = name; | 352 id_to_name_[expected_id] = name; |
351 return extension; | 353 return extension; |
352 } | 354 } |
OLD | NEW |