OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 class OmniboxViewTest : public InProcessBrowserTest, | 149 class OmniboxViewTest : public InProcessBrowserTest, |
150 public content::NotificationObserver, | 150 public content::NotificationObserver, |
151 public history::HistoryServiceObserver { | 151 public history::HistoryServiceObserver { |
152 public: | 152 public: |
153 OmniboxViewTest() : observer_(this) {} | 153 OmniboxViewTest() : observer_(this) {} |
154 | 154 |
155 // history::HisoryServiceObserver | 155 // history::HisoryServiceObserver |
156 void OnHistoryServiceLoaded( | 156 void OnHistoryServiceLoaded( |
157 history::HistoryService* history_service) override { | 157 history::HistoryService* history_service) override { |
158 base::MessageLoop::current()->Quit(); | 158 base::MessageLoop::current()->QuitWhenIdle(); |
159 } | 159 } |
160 | 160 |
161 protected: | 161 protected: |
162 void SetUpOnMainThread() override { | 162 void SetUpOnMainThread() override { |
163 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 163 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
164 ASSERT_NO_FATAL_FAILURE(SetupComponents()); | 164 ASSERT_NO_FATAL_FAILURE(SetupComponents()); |
165 chrome::FocusLocationBar(browser()); | 165 chrome::FocusLocationBar(browser()); |
166 ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); | 166 ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); |
167 } | 167 } |
168 | 168 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 const content::NotificationSource& source, | 362 const content::NotificationSource& source, |
363 const content::NotificationDetails& details) override { | 363 const content::NotificationDetails& details) override { |
364 switch (type) { | 364 switch (type) { |
365 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: | 365 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: |
366 case chrome::NOTIFICATION_TAB_PARENTED: | 366 case chrome::NOTIFICATION_TAB_PARENTED: |
367 case chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY: | 367 case chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY: |
368 break; | 368 break; |
369 default: | 369 default: |
370 FAIL() << "Unexpected notification type"; | 370 FAIL() << "Unexpected notification type"; |
371 } | 371 } |
372 base::MessageLoop::current()->Quit(); | 372 base::MessageLoop::current()->QuitWhenIdle(); |
373 } | 373 } |
374 | 374 |
375 void OnURLsModified(history::HistoryService* history_service, | 375 void OnURLsModified(history::HistoryService* history_service, |
376 const history::URLRows& changed_urls) override { | 376 const history::URLRows& changed_urls) override { |
377 base::MessageLoop::current()->Quit(); | 377 base::MessageLoop::current()->QuitWhenIdle(); |
378 } | 378 } |
379 | 379 |
380 private: | 380 private: |
381 ScopedObserver<history::HistoryService, OmniboxViewTest> observer_; | 381 ScopedObserver<history::HistoryService, OmniboxViewTest> observer_; |
382 | 382 |
383 DISALLOW_COPY_AND_ASSIGN(OmniboxViewTest); | 383 DISALLOW_COPY_AND_ASSIGN(OmniboxViewTest); |
384 }; | 384 }; |
385 | 385 |
386 // Test if ctrl-* accelerators are workable in omnibox. | 386 // Test if ctrl-* accelerators are workable in omnibox. |
387 // See http://crbug.com/19193: omnibox blocks ctrl-* commands | 387 // See http://crbug.com/19193: omnibox blocks ctrl-* commands |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 | 1956 |
1957 // Now Shift+Right should do nothing, and Shift+Left should reduce. | 1957 // Now Shift+Right should do nothing, and Shift+Left should reduce. |
1958 // At the end, so Shift+Right should do nothing. | 1958 // At the end, so Shift+Right should do nothing. |
1959 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, ui::EF_SHIFT_DOWN)); | 1959 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, ui::EF_SHIFT_DOWN)); |
1960 EXPECT_EQ(2u, GetSelectionSize(omnibox_view)); | 1960 EXPECT_EQ(2u, GetSelectionSize(omnibox_view)); |
1961 | 1961 |
1962 // And Left should reduce by one character. | 1962 // And Left should reduce by one character. |
1963 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, ui::EF_SHIFT_DOWN)); | 1963 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, ui::EF_SHIFT_DOWN)); |
1964 EXPECT_EQ(1u, GetSelectionSize(omnibox_view)); | 1964 EXPECT_EQ(1u, GetSelectionSize(omnibox_view)); |
1965 } | 1965 } |
OLD | NEW |