OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 #include "chrome/common/pref_names.h" | 83 #include "chrome/common/pref_names.h" |
84 #include "chrome/common/url_constants.h" | 84 #include "chrome/common/url_constants.h" |
85 #include "chrome/grit/browser_resources.h" | 85 #include "chrome/grit/browser_resources.h" |
86 #include "chrome/grit/generated_resources.h" | 86 #include "chrome/grit/generated_resources.h" |
87 #include "chrome/test/base/scoped_browser_locale.h" | 87 #include "chrome/test/base/scoped_browser_locale.h" |
88 #include "chrome/test/base/testing_profile.h" | 88 #include "chrome/test/base/testing_profile.h" |
89 #include "components/crx_file/id_util.h" | 89 #include "components/crx_file/id_util.h" |
90 #include "components/pref_registry/pref_registry_syncable.h" | 90 #include "components/pref_registry/pref_registry_syncable.h" |
91 #include "components/prefs/scoped_user_pref_update.h" | 91 #include "components/prefs/scoped_user_pref_update.h" |
92 #include "components/sync/model/string_ordinal.h" | 92 #include "components/sync/model/string_ordinal.h" |
93 #include "components/syncable_prefs/pref_service_syncable.h" | 93 #include "components/sync_preferences/pref_service_syncable.h" |
94 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 94 #include "components/sync_preferences/testing_pref_service_syncable.h" |
95 #include "content/public/browser/dom_storage_context.h" | 95 #include "content/public/browser/dom_storage_context.h" |
96 #include "content/public/browser/gpu_data_manager.h" | 96 #include "content/public/browser/gpu_data_manager.h" |
97 #include "content/public/browser/indexed_db_context.h" | 97 #include "content/public/browser/indexed_db_context.h" |
98 #include "content/public/browser/notification_service.h" | 98 #include "content/public/browser/notification_service.h" |
99 #include "content/public/browser/plugin_service.h" | 99 #include "content/public/browser/plugin_service.h" |
100 #include "content/public/browser/render_process_host.h" | 100 #include "content/public/browser/render_process_host.h" |
101 #include "content/public/browser/storage_partition.h" | 101 #include "content/public/browser/storage_partition.h" |
102 #include "content/public/common/content_constants.h" | 102 #include "content/public/common/content_constants.h" |
103 #include "content/public/test/test_browser_thread_bundle.h" | 103 #include "content/public/test/test_browser_thread_bundle.h" |
104 #include "content/public/test/test_utils.h" | 104 #include "content/public/test/test_utils.h" |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 service_->external_install_manager()->GetErrorsForTesting(); | 781 service_->external_install_manager()->GetErrorsForTesting(); |
782 auto found = std::find_if( | 782 auto found = std::find_if( |
783 errors.begin(), errors.end(), | 783 errors.begin(), errors.end(), |
784 [&extension_id](const ExternalInstallError* error) { | 784 [&extension_id](const ExternalInstallError* error) { |
785 return error->extension_id() == extension_id; | 785 return error->extension_id() == extension_id; |
786 }); | 786 }); |
787 return found == errors.end() ? nullptr : *found; | 787 return found == errors.end() ? nullptr : *found; |
788 } | 788 } |
789 | 789 |
790 typedef extensions::ExtensionManagementPrefUpdater< | 790 typedef extensions::ExtensionManagementPrefUpdater< |
791 syncable_prefs::TestingPrefServiceSyncable> ManagementPrefUpdater; | 791 sync_preferences::TestingPrefServiceSyncable> |
| 792 ManagementPrefUpdater; |
792 }; | 793 }; |
793 | 794 |
794 // Receives notifications from a PackExtensionJob, indicating either that | 795 // Receives notifications from a PackExtensionJob, indicating either that |
795 // packing succeeded or that there was some error. | 796 // packing succeeded or that there was some error. |
796 class PackExtensionTestClient : public extensions::PackExtensionJob::Client { | 797 class PackExtensionTestClient : public extensions::PackExtensionJob::Client { |
797 public: | 798 public: |
798 PackExtensionTestClient(const base::FilePath& expected_crx_path, | 799 PackExtensionTestClient(const base::FilePath& expected_crx_path, |
799 const base::FilePath& expected_private_key_path); | 800 const base::FilePath& expected_private_key_path); |
800 void OnPackSuccess(const base::FilePath& crx_path, | 801 void OnPackSuccess(const base::FilePath& crx_path, |
801 const base::FilePath& private_key_path) override; | 802 const base::FilePath& private_key_path) override; |
(...skipping 6148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6950 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); | 6951 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); |
6951 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); | 6952 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); |
6952 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6953 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
6953 | 6954 |
6954 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); | 6955 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); |
6955 UpdateExtension(id, v2_path, ENABLED); | 6956 UpdateExtension(id, v2_path, ENABLED); |
6956 | 6957 |
6957 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); | 6958 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); |
6958 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6959 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
6959 } | 6960 } |
OLD | NEW |