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

Unified Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service_unittest.cc
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index a23f98c3706d5341ce4a6006f67776361dc4153d..634ce5999535c57dcc75c09d786331fed877acea 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -470,20 +470,22 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase,
false),
expected_extensions_count_(0) {
registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
- content::NotificationService::AllSources());
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
+ extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
content::NotificationService::AllSources());
registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
+ extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
content::NotificationService::AllSources());
+ registrar_.Add(
+ this,
+ extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
+ content::NotificationService::AllSources());
}
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE {
switch (type) {
- case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
+ case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
const Extension* extension =
content::Details<const Extension>(details).ptr();
loaded_.push_back(make_scoped_refptr(extension));
@@ -493,7 +495,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase,
break;
}
- case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
+ case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
UnloadedExtensionInfo* unloaded_info =
content::Details<UnloadedExtensionInfo>(details).ptr();
const Extension* e = unloaded_info->extension;
@@ -508,7 +510,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase,
loaded_.erase(i);
break;
}
- case chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: {
+ case extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: {
const extensions::InstalledExtensionInfo* installed_info =
content::Details<const extensions::InstalledExtensionInfo>(details)
.ptr();
@@ -665,7 +667,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase,
installer->set_install_source(install_location);
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
installer->InstallCrx(crx_path);
observer.Wait();
@@ -791,7 +793,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase,
extensions::CrxInstaller* installer = NULL;
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
base::Bind(&IsCrxInstallerDone, &installer));
service()->UpdateExtension(id, path, true, &installer);
@@ -1105,7 +1107,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase,
installer->set_allow_silent_install(true);
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::Source<extensions::CrxInstaller>(installer));
installer->InstallCrx(crx_path);
@@ -1487,7 +1489,7 @@ TEST_F(ExtensionServiceTest, InstallingExternalExtensionWithFlags) {
// Register and install an external extension.
Version version("1.0.0.0");
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
if (service()->OnExternalExtensionFileFound(good_crx,
&version,
@@ -1522,7 +1524,7 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) {
// Install an external extension.
Version version("1.0.0.0");
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
if (service()->OnExternalExtensionFileFound(good_crx,
&version,
@@ -1620,7 +1622,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) {
// Install an external extension with an ID from the external
// source that is not equal to the ID in the extension manifest.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->OnExternalExtensionFileFound(wrong_id,
&version,
@@ -1634,7 +1636,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) {
// Try again with the right ID. Expect success.
content::WindowedNotificationObserver observer2(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
if (service()->OnExternalExtensionFileFound(correct_id,
&version,
@@ -1657,7 +1659,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongVersion) {
// source that is not equal to the version in the extension manifest.
Version wrong_version("1.2.3.4");
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->OnExternalExtensionFileFound(good_crx,
&wrong_version,
@@ -1673,7 +1675,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongVersion) {
service()->pending_extension_manager()->Remove(good_crx);
Version correct_version("1.0.0.0");
content::WindowedNotificationObserver observer2(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
if (service()->OnExternalExtensionFileFound(good_crx,
&correct_version,
@@ -3682,7 +3684,7 @@ TEST_F(ExtensionServiceTest, PolicyInstalledExtensionsWhitelisted) {
// Reloading extensions should find our externally registered extension
// and install it.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer.Wait();
@@ -3878,7 +3880,7 @@ TEST_F(ExtensionServiceTest, MAYBE_ExternalExtensionAutoAcknowledgement) {
// Providers are set up. Let them run.
int count = 2;
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
base::Bind(&WaitForCountNotificationsCallback, &count));
service()->CheckForExternalUpdates();
@@ -3920,7 +3922,7 @@ TEST_F(ExtensionServiceTest, DefaultAppsInstall) {
ASSERT_EQ(0u, registry()->enabled_extensions().size());
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer.Wait();
@@ -4608,7 +4610,7 @@ void ExtensionServiceTest::TestExternalProvider(
// Reloading extensions should find our externally registered extension
// and install it.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer.Wait();
@@ -4638,7 +4640,7 @@ void ExtensionServiceTest::TestExternalProvider(
loaded_.clear();
content::WindowedNotificationObserver observer_2(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer_2.Wait();
@@ -4681,7 +4683,7 @@ void ExtensionServiceTest::TestExternalProvider(
loaded_.clear();
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer.Wait();
@@ -4710,7 +4712,7 @@ void ExtensionServiceTest::TestExternalProvider(
// Now test the case where user uninstalls and then the extension is removed
// from the external provider.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
provider->UpdateOrAddExtension(good_crx, "1.0.0.1", source_path);
service()->CheckForExternalUpdates();
@@ -4863,7 +4865,7 @@ TEST_F(ExtensionServiceTest, MultipleExternalUpdateCheck) {
// Two checks for external updates should find the extension, and install it
// once.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
provider->set_visit_count(0);
service()->CheckForExternalUpdates();
@@ -5111,7 +5113,8 @@ TEST_F(ExtensionServiceTest, LoadAndRelocalizeExtensions) {
class ExtensionsReadyRecorder : public content::NotificationObserver {
public:
ExtensionsReadyRecorder() : ready_(false) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY,
+ registrar_.Add(this,
+ extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED,
content::NotificationService::AllSources());
}
@@ -5123,7 +5126,7 @@ class ExtensionsReadyRecorder : public content::NotificationObserver {
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE {
switch (type) {
- case chrome::NOTIFICATION_EXTENSIONS_READY:
+ case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED:
ready_ = true;
break;
default:
@@ -6253,7 +6256,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
{
// Simulate an external source adding the extension as INTERNAL.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
EXPECT_TRUE(service()->OnExternalExtensionFileFound(kGoodId,
&older_version,
@@ -6269,7 +6272,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
{
// Simulate an external source adding the extension as EXTERNAL_PREF.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
EXPECT_TRUE(service()->OnExternalExtensionFileFound(kGoodId,
&older_version,
@@ -6305,7 +6308,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
{
// Now the registry adds the extension.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
EXPECT_TRUE(
service()->OnExternalExtensionFileFound(kGoodId,
@@ -6622,7 +6625,7 @@ TEST_F(ExtensionSourcePriorityTest, PendingExternalFileOverSync) {
// Install pending extension from sync.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
EXPECT_TRUE(AddPendingSyncInstall());
ASSERT_EQ(Manifest::INTERNAL, GetPendingLocation());
@@ -6681,7 +6684,7 @@ TEST_F(ExtensionSourcePriorityTest, InstallExternalBlocksSyncRequest) {
// Before the CRX installer runs, Sync requests that the same extension
// be installed. Should fail, because an external source is pending.
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
ASSERT_FALSE(AddPendingSyncInstall());
@@ -6728,7 +6731,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallGlobalError) {
hosted_app, "1.0.0.0", data_dir().AppendASCII("hosted_app.crx"));
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer.Wait();
@@ -6741,7 +6744,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallGlobalError) {
page_action, "1.0.0.0", data_dir().AppendASCII("page_action.crx"));
content::WindowedNotificationObserver observer2(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer2.Wait();
@@ -6763,7 +6766,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallInitiallyDisabled) {
page_action, "1.0.0.0", data_dir().AppendASCII("page_action.crx"));
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer.Wait();
@@ -6806,7 +6809,7 @@ TEST_F(ExtensionServiceTest, MAYBE_ExternalInstallMultiple) {
int count = 3;
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
base::Bind(&WaitForCountNotificationsCallback, &count));
service()->CheckForExternalUpdates();
observer.Wait();
@@ -6858,7 +6861,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallUpdatesFromWebstoreOldProfile) {
provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path);
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer.Wait();
@@ -6887,7 +6890,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallUpdatesFromWebstoreNewProfile) {
provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path);
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service()->CheckForExternalUpdates();
observer.Wait();
@@ -6919,7 +6922,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallClickToRemove) {
provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path);
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service_->CheckForExternalUpdates();
observer.Wait();
@@ -6961,7 +6964,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallClickToKeep) {
provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path);
content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+ extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
service_->CheckForExternalUpdates();
observer.Wait();
@@ -7012,7 +7015,7 @@ TEST_F(ExtensionServiceTest, InstallBlacklistedExtension) {
// Extension was installed but not loaded.
EXPECT_TRUE(notifications.CheckNotifications(
- chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED));
+ extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED));
EXPECT_TRUE(service()->GetInstalledExtension(id));
EXPECT_FALSE(registry()->enabled_extensions().Contains(id));
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_startup_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698