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

Unified Diff: chrome/browser/extensions/api/idle/idle_api_unittest.cc

Issue 275383002: Use ExtensionRegistryObserver instead of deprecated extension notification from c/b/e/api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/idle/idle_api_unittest.cc
diff --git a/chrome/browser/extensions/api/idle/idle_api_unittest.cc b/chrome/browser/extensions/api/idle/idle_api_unittest.cc
index 83c03cb54afd79f5ebad2fb5d447aec1267b9797..cb49004947921d5c76be6ef84704da2131daaaaa 100644
--- a/chrome/browser/extensions/api/idle/idle_api_unittest.cc
+++ b/chrome/browser/extensions/api/idle/idle_api_unittest.cc
@@ -17,6 +17,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -509,12 +510,9 @@ TEST_F(IdleTest, UnloadCleanup) {
}
// Threshold will reset after unload (and listen count == 0)
- UnloadedExtensionInfo details(extension(),
- UnloadedExtensionInfo::REASON_UNINSTALL);
- idle_manager_->Observe(
- chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<Profile>(browser()->profile()),
- content::Details<UnloadedExtensionInfo>(&details));
+ ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
+ registry->TriggerOnUnloaded(extension(),
+ UnloadedExtensionInfo::REASON_UNINSTALL);
{
ScopedListen listen(idle_manager_, extension()->id());
@@ -530,24 +528,18 @@ TEST_F(IdleTest, UnloadCleanup) {
// Verifies that unloading an extension with no listeners or threshold works.
TEST_F(IdleTest, UnloadOnly) {
- UnloadedExtensionInfo details(extension(),
- UnloadedExtensionInfo::REASON_UNINSTALL);
- idle_manager_->Observe(
- chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<Profile>(browser()->profile()),
- content::Details<UnloadedExtensionInfo>(&details));
+ ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
+ registry->TriggerOnUnloaded(extension(),
+ UnloadedExtensionInfo::REASON_UNINSTALL);
}
// Verifies that its ok for the unload notification to happen before all the
// listener removals.
TEST_F(IdleTest, UnloadWhileListening) {
ScopedListen listen(idle_manager_, extension()->id());
- UnloadedExtensionInfo details(extension(),
- UnloadedExtensionInfo::REASON_UNINSTALL);
- idle_manager_->Observe(
- chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<Profile>(browser()->profile()),
- content::Details<UnloadedExtensionInfo>(&details));
+ ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
+ registry->TriggerOnUnloaded(extension(),
+ UnloadedExtensionInfo::REASON_UNINSTALL);
}
// Verifies that re-adding a listener after a state change doesn't immediately

Powered by Google App Engine
This is Rietveld 408576698