Chromium Code Reviews| 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 1ca983ce8810e1a3393c97517ade6a88181619a7..8740187476f9e8cc719bdb089d2609809bea75bc 100644 |
| --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc |
| +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc |
| @@ -141,6 +141,14 @@ const int kCtrlOrCmdMask = ui::EF_CONTROL_DOWN; |
| class OmniboxViewTest : public InProcessBrowserTest, |
| 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())); |
| @@ -285,9 +293,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(); |
| } |
| @@ -349,7 +355,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: |
| break; |
| default: |
| FAIL() << "Unexpected notification type"; |
| @@ -361,6 +366,9 @@ class OmniboxViewTest : public InProcessBrowserTest, |
| const history::URLRows& changed_urls) override { |
| base::MessageLoop::current()->Quit(); |
| } |
| + |
| + private: |
| + ScopedObserver<HistoryService, OmniboxViewTest> observer_; |
| }; |
|
Peter Kasting
2014/11/17 18:45:32
Nit: Technically, this class should probably have
nshaik
2014/11/17 23:24:29
Done.
|
| // Test if ctrl-* accelerators are workable in omnibox. |