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

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 671763002: Extract ProcessManager from ExtensionSystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 1 month 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) 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after
2812 2812
2813 #if !defined(OS_POSIX) || defined(OS_MACOSX) 2813 #if !defined(OS_POSIX) || defined(OS_MACOSX)
2814 // LOAD extensions with plugins require approval. 2814 // LOAD extensions with plugins require approval.
2815 // Only run this on platforms that support NPAPI plugins. 2815 // Only run this on platforms that support NPAPI plugins.
2816 TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) { 2816 TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) {
2817 base::FilePath extension_with_plugin_path = good1_path(); 2817 base::FilePath extension_with_plugin_path = good1_path();
2818 base::FilePath extension_no_plugin_path = good2_path(); 2818 base::FilePath extension_no_plugin_path = good2_path();
2819 2819
2820 InitPluginService(); 2820 InitPluginService();
2821 InitializeEmptyExtensionService(); 2821 InitializeEmptyExtensionService();
2822 InitializeProcessManager();
2823 service()->set_show_extensions_prompts(true); 2822 service()->set_show_extensions_prompts(true);
2824 2823
2825 // Start by canceling any install prompts. 2824 // Start by canceling any install prompts.
2826 ExtensionInstallPrompt::g_auto_confirm_for_tests = 2825 ExtensionInstallPrompt::g_auto_confirm_for_tests =
2827 ExtensionInstallPrompt::CANCEL; 2826 ExtensionInstallPrompt::CANCEL;
2828 2827
2829 // The extension that has a plugin should not install. 2828 // The extension that has a plugin should not install.
2830 extensions::UnpackedInstaller::Create(service()) 2829 extensions::UnpackedInstaller::Create(service())
2831 ->Load(extension_with_plugin_path); 2830 ->Load(extension_with_plugin_path);
2832 base::RunLoop().RunUntilIdle(); 2831 base::RunLoop().RunUntilIdle();
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 service()->ReloadExtensionsForTest(); 4062 service()->ReloadExtensionsForTest();
4064 4063
4065 // Extension counts shouldn't change. 4064 // Extension counts shouldn't change.
4066 EXPECT_EQ(1u, registry()->enabled_extensions().size()); 4065 EXPECT_EQ(1u, registry()->enabled_extensions().size());
4067 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 4066 EXPECT_EQ(0u, registry()->disabled_extensions().size());
4068 } 4067 }
4069 4068
4070 // Tests reloading an extension. 4069 // Tests reloading an extension.
4071 TEST_F(ExtensionServiceTest, ReloadExtension) { 4070 TEST_F(ExtensionServiceTest, ReloadExtension) {
4072 InitializeEmptyExtensionService(); 4071 InitializeEmptyExtensionService();
4073 InitializeProcessManager();
4074 4072
4075 // Simple extension that should install without error. 4073 // Simple extension that should install without error.
4076 const char* extension_id = "behllobkkfkfnphdnhnkndlbkcpglgmj"; 4074 const char* extension_id = "behllobkkfkfnphdnhnkndlbkcpglgmj";
4077 base::FilePath ext = data_dir() 4075 base::FilePath ext = data_dir()
4078 .AppendASCII("good") 4076 .AppendASCII("good")
4079 .AppendASCII("Extensions") 4077 .AppendASCII("Extensions")
4080 .AppendASCII(extension_id) 4078 .AppendASCII(extension_id)
4081 .AppendASCII("1.0.0.0"); 4079 .AppendASCII("1.0.0.0");
4082 extensions::UnpackedInstaller::Create(service())->Load(ext); 4080 extensions::UnpackedInstaller::Create(service())->Load(ext);
4083 base::RunLoop().RunUntilIdle(); 4081 base::RunLoop().RunUntilIdle();
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
5551 new syncer::FakeSyncChangeProcessor), 5549 new syncer::FakeSyncChangeProcessor),
5552 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock())); 5550 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock()));
5553 5551
5554 syncer::SyncDataList list = 5552 syncer::SyncDataList list =
5555 extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS); 5553 extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
5556 ASSERT_EQ(list.size(), 0U); 5554 ASSERT_EQ(list.size(), 0U);
5557 } 5555 }
5558 5556
5559 TEST_F(ExtensionServiceTest, GetSyncExtensionDataUserSettings) { 5557 TEST_F(ExtensionServiceTest, GetSyncExtensionDataUserSettings) {
5560 InitializeEmptyExtensionService(); 5558 InitializeEmptyExtensionService();
5561 InitializeProcessManager();
5562 InitializeExtensionSyncService(); 5559 InitializeExtensionSyncService();
5563 InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW); 5560 InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW);
5564 const Extension* extension = service()->GetInstalledExtension(good_crx); 5561 const Extension* extension = service()->GetInstalledExtension(good_crx);
5565 ASSERT_TRUE(extension); 5562 ASSERT_TRUE(extension);
5566 5563
5567 syncer::FakeSyncChangeProcessor processor; 5564 syncer::FakeSyncChangeProcessor processor;
5568 extension_sync_service()->MergeDataAndStartSyncing( 5565 extension_sync_service()->MergeDataAndStartSyncing(
5569 syncer::EXTENSIONS, 5566 syncer::EXTENSIONS,
5570 syncer::SyncDataList(), 5567 syncer::SyncDataList(),
5571 scoped_ptr<syncer::SyncChangeProcessor>( 5568 scoped_ptr<syncer::SyncChangeProcessor>(
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
5873 list[0] = sync_change; 5870 list[0] = sync_change;
5874 5871
5875 // Should again do nothing. 5872 // Should again do nothing.
5876 extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); 5873 extension_sync_service()->ProcessSyncChanges(FROM_HERE, list);
5877 EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); 5874 EXPECT_TRUE(service()->GetExtensionById(good_crx, false));
5878 } 5875 }
5879 } 5876 }
5880 5877
5881 TEST_F(ExtensionServiceTest, ProcessSyncDataSettings) { 5878 TEST_F(ExtensionServiceTest, ProcessSyncDataSettings) {
5882 InitializeEmptyExtensionService(); 5879 InitializeEmptyExtensionService();
5883 InitializeProcessManager();
5884 InitializeExtensionSyncService(); 5880 InitializeExtensionSyncService();
5885 syncer::FakeSyncChangeProcessor processor; 5881 syncer::FakeSyncChangeProcessor processor;
5886 extension_sync_service()->MergeDataAndStartSyncing( 5882 extension_sync_service()->MergeDataAndStartSyncing(
5887 syncer::EXTENSIONS, 5883 syncer::EXTENSIONS,
5888 syncer::SyncDataList(), 5884 syncer::SyncDataList(),
5889 scoped_ptr<syncer::SyncChangeProcessor>( 5885 scoped_ptr<syncer::SyncChangeProcessor>(
5890 new syncer::FakeSyncChangeProcessor), 5886 new syncer::FakeSyncChangeProcessor),
5891 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock())); 5887 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock()));
5892 5888
5893 InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW); 5889 InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW);
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
7131 7127
7132 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 7128 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
7133 content::Source<Profile>(profile()), 7129 content::Source<Profile>(profile()),
7134 content::NotificationService::NoDetails()); 7130 content::NotificationService::NoDetails());
7135 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 7131 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
7136 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 7132 EXPECT_EQ(0u, registry()->enabled_extensions().size());
7137 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 7133 EXPECT_EQ(0u, registry()->disabled_extensions().size());
7138 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 7134 EXPECT_EQ(0u, registry()->terminated_extensions().size());
7139 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 7135 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
7140 } 7136 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_test_base.cc ('k') | chrome/browser/extensions/extension_system_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698