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_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.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_util.h" | 12 #include "chrome/browser/extensions/extension_util.h" |
13 #include "chrome/browser/extensions/pending_extension_info.h" | 13 #include "chrome/browser/extensions/pending_extension_info.h" |
14 #include "chrome/browser/extensions/pending_extension_manager.h" | 14 #include "chrome/browser/extensions/pending_extension_manager.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 16 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
17 #include "chrome/browser/sync/test/integration/sync_test.h" | 17 #include "chrome/browser/sync/test/integration/sync_test.h" |
18 #include "extensions/browser/extension_registry.h" | 18 #include "extensions/browser/extension_registry.h" |
19 #include "extensions/browser/extension_system.h" | 19 #include "extensions/browser/extension_system.h" |
| 20 #include "extensions/browser/install_flag.h" |
20 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
21 #include "extensions/common/extension_set.h" | 22 #include "extensions/common/extension_set.h" |
22 #include "extensions/common/id_util.h" | 23 #include "extensions/common/id_util.h" |
23 #include "extensions/common/manifest_constants.h" | 24 #include "extensions/common/manifest_constants.h" |
24 #include "sync/api/string_ordinal.h" | 25 #include "sync/api/string_ordinal.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
26 | 27 |
27 using extensions::Extension; | 28 using extensions::Extension; |
28 using extensions::ExtensionRegistry; | 29 using extensions::ExtensionRegistry; |
29 using extensions::Manifest; | 30 using extensions::Manifest; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 Profile* profile, const std::string& name, Manifest::Type type) { | 67 Profile* profile, const std::string& name, Manifest::Type type) { |
67 scoped_refptr<Extension> extension = GetExtension(profile, name, type); | 68 scoped_refptr<Extension> extension = GetExtension(profile, name, type); |
68 if (!extension.get()) { | 69 if (!extension.get()) { |
69 NOTREACHED() << "Could not install extension " << name; | 70 NOTREACHED() << "Could not install extension " << name; |
70 return std::string(); | 71 return std::string(); |
71 } | 72 } |
72 extensions::ExtensionSystem::Get(profile) | 73 extensions::ExtensionSystem::Get(profile) |
73 ->extension_service() | 74 ->extension_service() |
74 ->OnExtensionInstalled(extension.get(), | 75 ->OnExtensionInstalled(extension.get(), |
75 syncer::StringOrdinal(), | 76 syncer::StringOrdinal(), |
76 false /* no requirement errors */, | 77 extensions::kInstallFlagInstallImmediately); |
77 extensions::NOT_BLACKLISTED, | |
78 false /* not ephemeral */, | |
79 false /* don't wait for idle to install */); | |
80 return extension->id(); | 78 return extension->id(); |
81 } | 79 } |
82 | 80 |
83 void SyncExtensionHelper::UninstallExtension( | 81 void SyncExtensionHelper::UninstallExtension( |
84 Profile* profile, const std::string& name) { | 82 Profile* profile, const std::string& name) { |
85 ExtensionService::UninstallExtensionHelper( | 83 ExtensionService::UninstallExtensionHelper( |
86 extensions::ExtensionSystem::Get(profile)->extension_service(), | 84 extensions::ExtensionSystem::Get(profile)->extension_service(), |
87 extensions::id_util::GenerateId(name)); | 85 extensions::id_util::GenerateId(name)); |
88 } | 86 } |
89 | 87 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 EXPECT_EQ(expected_id, extension->id()); | 387 EXPECT_EQ(expected_id, extension->id()); |
390 return NULL; | 388 return NULL; |
391 } | 389 } |
392 DVLOG(2) << "created extension with name = " | 390 DVLOG(2) << "created extension with name = " |
393 << name << ", id = " << expected_id; | 391 << name << ", id = " << expected_id; |
394 (it->second)[name] = extension; | 392 (it->second)[name] = extension; |
395 id_to_name_[expected_id] = name; | 393 id_to_name_[expected_id] = name; |
396 id_to_type_[expected_id] = type; | 394 id_to_type_[expected_id] = type; |
397 return extension; | 395 return extension; |
398 } | 396 } |
OLD | NEW |