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..1ca983ce8810e1a3393c97517ade6a88181619a7 100644 |
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc |
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc |
@@ -5,6 +5,7 @@ |
#include <stdio.h> |
#include "base/command_line.h" |
+#include "base/scoped_observer.h" |
#include "base/strings/string16.h" |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -34,6 +35,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" |
@@ -137,7 +139,8 @@ const int kCtrlOrCmdMask = ui::EF_CONTROL_DOWN; |
} // namespace |
class OmniboxViewTest : public InProcessBrowserTest, |
- public content::NotificationObserver { |
+ public content::NotificationObserver, |
+ public history::HistoryServiceObserver { |
protected: |
void SetUpOnMainThread() override { |
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
@@ -304,9 +307,9 @@ class OmniboxViewTest : public InProcessBrowserTest, |
bookmarks::AddIfNotBookmarked(bookmark_model, url, base::string16()); |
// Wait at least for the AddPageWithDetails() call to finish. |
{ |
- content::NotificationRegistrar registrar; |
- registrar.Add(this, chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, |
- content::Source<Profile>(profile)); |
+ ScopedObserver<HistoryService, history::HistoryServiceObserver> observer( |
+ this); |
+ observer.Add(history_service); |
content::RunMessageLoop(); |
// We don't want to return until all observers have processed this |
// notification, because some (e.g. the in-memory history database) may do |
@@ -347,13 +350,17 @@ class OmniboxViewTest : public InProcessBrowserTest, |
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: |
FAIL() << "Unexpected notification type"; |
} |
base::MessageLoop::current()->Quit(); |
} |
+ |
+ void OnURLsModified(HistoryService* history_service, |
+ const history::URLRows& changed_urls) override { |
+ base::MessageLoop::current()->Quit(); |
+ } |
}; |
// Test if ctrl-* accelerators are workable in omnibox. |