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 f5ae22f32525d6e42bddfb9746526caad715e200..2ede1eb1beb31ae3a5ad2a421d2ee3b7c94f0a27 100644 |
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc |
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc |
@@ -34,6 +34,7 @@ |
#include "components/bookmarks/browser/bookmark_model.h" |
#include "components/bookmarks/browser/bookmark_utils.h" |
#include "components/bookmarks/test/bookmark_test_helpers.h" |
+#include "components/history/core/browser/history_service_observer.h" |
#include "components/omnibox/autocomplete_input.h" |
#include "components/omnibox/autocomplete_match.h" |
#include "components/search_engines/template_url.h" |
@@ -138,7 +139,21 @@ const int kCtrlOrCmdMask = ui::EF_CONTROL_DOWN; |
} // namespace |
class OmniboxViewTest : public InProcessBrowserTest, |
- public content::NotificationObserver { |
+ public content::NotificationObserver, |
+ public history::HistoryServiceObserver { |
+ public: |
+ virtual void HistoryServiceLoaded(HistoryService* history_service) OVERRIDE { |
+ history_service->RemoveHistoryServiceObserver(this); |
sdefresne
2014/10/20 13:15:42
Use ScopedObserver<>
nshaik
2014/10/29 08:43:39
Done.
|
+ base::MessageLoop::current()->Quit(); |
+ } |
+ |
+ virtual ~OmniboxViewTest() { |
+ Profile* profile = browser()->profile(); |
sdefresne
2014/10/20 13:15:42
You can remove this if you use ScopedObserver<>
nshaik
2014/10/29 08:43:39
Done.
|
+ HistoryService* history_service = |
+ HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); |
+ history_service->RemoveHistoryServiceObserver(this); |
+ } |
+ |
protected: |
virtual void SetUpOnMainThread() OVERRIDE { |
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
@@ -283,9 +298,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)); |
+ history_service->AddHistoryServiceObserver(this); |
content::RunMessageLoop(); |
} |
@@ -347,7 +360,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: |