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

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

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 7 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
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "components/pref_registry/pref_registry_syncable.h" 77 #include "components/pref_registry/pref_registry_syncable.h"
78 #include "content/public/browser/dom_storage_context.h" 78 #include "content/public/browser/dom_storage_context.h"
79 #include "content/public/browser/gpu_data_manager.h" 79 #include "content/public/browser/gpu_data_manager.h"
80 #include "content/public/browser/indexed_db_context.h" 80 #include "content/public/browser/indexed_db_context.h"
81 #include "content/public/browser/notification_registrar.h" 81 #include "content/public/browser/notification_registrar.h"
82 #include "content/public/browser/notification_service.h" 82 #include "content/public/browser/notification_service.h"
83 #include "content/public/browser/plugin_service.h" 83 #include "content/public/browser/plugin_service.h"
84 #include "content/public/browser/render_process_host.h" 84 #include "content/public/browser/render_process_host.h"
85 #include "content/public/browser/storage_partition.h" 85 #include "content/public/browser/storage_partition.h"
86 #include "content/public/common/content_constants.h" 86 #include "content/public/common/content_constants.h"
87 #include "content/public/test/test_browser_thread_bundle.h"
87 #include "content/public/test/test_utils.h" 88 #include "content/public/test/test_utils.h"
88 #include "extensions/browser/extension_prefs.h" 89 #include "extensions/browser/extension_prefs.h"
89 #include "extensions/browser/extension_registry.h" 90 #include "extensions/browser/extension_registry.h"
90 #include "extensions/browser/extension_system.h" 91 #include "extensions/browser/extension_system.h"
91 #include "extensions/browser/external_provider_interface.h" 92 #include "extensions/browser/external_provider_interface.h"
92 #include "extensions/browser/install_flag.h" 93 #include "extensions/browser/install_flag.h"
93 #include "extensions/browser/management_policy.h" 94 #include "extensions/browser/management_policy.h"
94 #include "extensions/browser/test_management_policy.h" 95 #include "extensions/browser/test_management_policy.h"
95 #include "extensions/browser/uninstall_reason.h" 96 #include "extensions/browser/uninstall_reason.h"
96 #include "extensions/common/constants.h" 97 #include "extensions/common/constants.h"
(...skipping 5494 matching lines...) Expand 10 before | Expand all | Expand 10 after
5591 content::NotificationRegistrar registrar_; 5592 content::NotificationRegistrar registrar_;
5592 bool ready_; 5593 bool ready_;
5593 }; 5594 };
5594 5595
5595 // Test that we get enabled/disabled correctly for all the pref/command-line 5596 // Test that we get enabled/disabled correctly for all the pref/command-line
5596 // combinations. We don't want to derive from the ExtensionServiceTest class 5597 // combinations. We don't want to derive from the ExtensionServiceTest class
5597 // for this test, so we use ExtensionServiceTestSimple. 5598 // for this test, so we use ExtensionServiceTestSimple.
5598 // 5599 //
5599 // Also tests that we always fire EXTENSIONS_READY, no matter whether we are 5600 // Also tests that we always fire EXTENSIONS_READY, no matter whether we are
5600 // enabled or not. 5601 // enabled or not.
5601 TEST(ExtensionServiceTestSimple, Enabledness) { 5602 class ExtensionServiceTestSimple : public testing::Test {
5603 content::TestBrowserThreadBundle thread_bundle_;
5604 };
5605
5606 TEST_F(ExtensionServiceTestSimple, Enabledness) {
5602 // Make sure the PluginService singleton is destroyed at the end of the test. 5607 // Make sure the PluginService singleton is destroyed at the end of the test.
5603 base::ShadowingAtExitManager at_exit_manager; 5608 base::ShadowingAtExitManager at_exit_manager;
5604 #if defined(ENABLE_PLUGINS) 5609 #if defined(ENABLE_PLUGINS)
5605 content::PluginService::GetInstance()->Init(); 5610 content::PluginService::GetInstance()->Init();
5606 content::PluginService::GetInstance()->DisablePluginsDiscoveryForTesting(); 5611 content::PluginService::GetInstance()->DisablePluginsDiscoveryForTesting();
5607 #endif 5612 #endif
5608 5613
5609 ExtensionErrorReporter::Init(false); // no noisy errors 5614 ExtensionErrorReporter::Init(false); // no noisy errors
5610 ExtensionsReadyRecorder recorder; 5615 ExtensionsReadyRecorder recorder;
5611 scoped_ptr<TestingProfile> profile(new TestingProfile()); 5616 scoped_ptr<TestingProfile> profile(new TestingProfile());
5612 content::TestBrowserThreadBundle thread_bundle_;
5613 #if defined OS_CHROMEOS 5617 #if defined OS_CHROMEOS
5614 chromeos::ScopedTestDeviceSettingsService device_settings_service; 5618 chromeos::ScopedTestDeviceSettingsService device_settings_service;
5615 chromeos::ScopedTestCrosSettings cros_settings; 5619 chromeos::ScopedTestCrosSettings cros_settings;
5616 scoped_ptr<chromeos::ScopedTestUserManager> user_manager( 5620 scoped_ptr<chromeos::ScopedTestUserManager> user_manager(
5617 new chromeos::ScopedTestUserManager); 5621 new chromeos::ScopedTestUserManager);
5618 #endif 5622 #endif
5619 scoped_ptr<base::CommandLine> command_line; 5623 scoped_ptr<base::CommandLine> command_line;
5620 base::FilePath install_dir = profile->GetPath() 5624 base::FilePath install_dir = profile->GetPath()
5621 .AppendASCII(extensions::kInstallDirectoryName); 5625 .AppendASCII(extensions::kInstallDirectoryName);
5622 5626
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
7767 7771
7768 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 7772 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
7769 content::Source<Profile>(profile()), 7773 content::Source<Profile>(profile()),
7770 content::NotificationService::NoDetails()); 7774 content::NotificationService::NoDetails());
7771 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 7775 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
7772 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 7776 EXPECT_EQ(0u, registry()->enabled_extensions().size());
7773 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 7777 EXPECT_EQ(0u, registry()->disabled_extensions().size());
7774 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 7778 EXPECT_EQ(0u, registry()->terminated_extensions().size());
7775 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 7779 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
7776 } 7780 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698