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

Unified Diff: chrome/browser/autocomplete/shortcuts_provider_unittest.cc

Issue 271393003: Use ExtensionRegistryObserver instead of deprecated extension notification from autocomplete (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/autocomplete/shortcuts_provider_unittest.cc
diff --git a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
index bb3ca8d0ebe06b7336d5a1e7c12e9589084cb3a8..6077a86aef7ea3ae2d1312bbe9cc8a31450eb552 100644
--- a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
+++ b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
@@ -32,6 +32,7 @@
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_browser_thread.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/value_builder.h"
@@ -288,7 +289,7 @@ class ShortcutsProviderTest : public testing::Test,
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
- TestingProfile profile_;
+ scoped_ptr<TestingProfile> profile_;
ACMatches ac_matches_; // The resulting matches after running RunTest.
@@ -298,18 +299,20 @@ class ShortcutsProviderTest : public testing::Test,
ShortcutsProviderTest::ShortcutsProviderTest()
: ui_thread_(content::BrowserThread::UI, &message_loop_),
- file_thread_(content::BrowserThread::FILE, &message_loop_) {
+ file_thread_(content::BrowserThread::FILE, &message_loop_),
+ profile_(new TestingProfile) {
not at google - send to devlin 2014/05/12 17:59:00 ditto, though in this case it's basically the same
Peter Kasting 2014/05/12 19:46:55 I'm wondering this too.
limasdf 2014/05/13 14:38:44 for consistent with extension_app_provider_unittes
}
void ShortcutsProviderTest::OnProviderUpdate(bool updated_matches) {}
void ShortcutsProviderTest::SetUp() {
ShortcutsBackendFactory::GetInstance()->SetTestingFactoryAndUse(
- &profile_, &ShortcutsBackendFactory::BuildProfileNoDatabaseForTesting);
- backend_ = ShortcutsBackendFactory::GetForProfile(&profile_);
+ profile_.get(),
+ &ShortcutsBackendFactory::BuildProfileNoDatabaseForTesting);
+ backend_ = ShortcutsBackendFactory::GetForProfile(profile_.get());
ASSERT_TRUE(backend_.get());
- ASSERT_TRUE(profile_.CreateHistoryService(true, false));
- provider_ = new ShortcutsProvider(this, &profile_);
+ ASSERT_TRUE(profile_.get()->CreateHistoryService(true, false));
Peter Kasting 2014/05/12 19:46:55 There's no need to use "get()" before "->".
limasdf 2014/05/13 14:38:44 back to original. Done.
+ provider_ = new ShortcutsProvider(this, profile_.get());
FillData(shortcut_test_db, arraysize(shortcut_test_db));
}
@@ -841,12 +844,10 @@ TEST_F(ShortcutsProviderTest, Extension) {
.Set("version", "1.0"))
.SetID("cedabbhfglmiikkmdgcpjdkocfcmbkee")
.Build();
- extensions::UnloadedExtensionInfo details(
+ extensions::ExtensionRegistry* registry =
+ extensions::ExtensionRegistry::Get(profile_.get());
+ registry->TriggerOnUnloaded(
extension.get(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL);
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<Profile>(&profile_),
- content::Details<extensions::UnloadedExtensionInfo>(&details));
// Now the URL should have disappeared.
RunTest(text, false, ExpectedURLs(), std::string(), base::string16());

Powered by Google App Engine
This is Rietveld 408576698