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

Unified Diff: chrome/browser/ui/omnibox/omnibox_view_browsertest.cc

Issue 573553004: Eliminate NOTIFICATION_HISTORY_LOADED notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Listen HistoryServiceBeingDeleted in LastDownloadFinder for cleanup 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
index 4a0f5c1a339d6e4a7506e04ddb8a2f17a5190113..4e970e065c87ce95a0c696052f140bdc8530d3b6 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -137,7 +137,16 @@ const int kCtrlOrCmdMask = ui::EF_CONTROL_DOWN;
} // namespace
class OmniboxViewTest : public InProcessBrowserTest,
- public content::NotificationObserver {
+ public content::NotificationObserver,
+ public history::HistoryServiceObserver {
+ public:
+ OmniboxViewTest() : observer_(this) {}
+
+ // history::HisoryServiceObserver
+ void OnHistoryServiceLoaded(HistoryService* history_service) override {
+ base::MessageLoop::current()->Quit();
+ }
+
protected:
void SetUpOnMainThread() override {
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
@@ -282,9 +291,7 @@ class OmniboxViewTest : public InProcessBrowserTest,
ASSERT_TRUE(history_service);
if (!history_service->BackendLoaded()) {
- content::NotificationRegistrar registrar;
- registrar.Add(this, chrome::NOTIFICATION_HISTORY_LOADED,
- content::Source<Profile>(profile));
+ observer_.Add(history_service);
content::RunMessageLoop();
}
@@ -346,7 +353,6 @@ class OmniboxViewTest : public InProcessBrowserTest,
case content::NOTIFICATION_WEB_CONTENTS_DESTROYED:
case chrome::NOTIFICATION_TAB_PARENTED:
case chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY:
- case chrome::NOTIFICATION_HISTORY_LOADED:
case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED:
break;
default:
@@ -354,6 +360,9 @@ class OmniboxViewTest : public InProcessBrowserTest,
}
base::MessageLoop::current()->Quit();
}
+
+ private:
+ ScopedObserver<HistoryService, OmniboxViewTest> observer_;
};
// Test if ctrl-* accelerators are workable in omnibox.

Powered by Google App Engine
This is Rietveld 408576698