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

Unified Diff: chrome/browser/views/find_bar_host_interactive_uitest.cc

Issue 3117030: Adds ui_test_utils::SendAndWaitForKeyPress and converts callers (where (Closed)
Patch Set: Addressed review comments Created 10 years, 4 months 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/views/find_bar_host_interactive_uitest.cc
diff --git a/chrome/browser/views/find_bar_host_interactive_uitest.cc b/chrome/browser/views/find_bar_host_interactive_uitest.cc
index f866f094b45028de9e3e3083d37714f24da8f97e..69d728466b45ca44fcdcf4f3c9cf641f9a02bf62 100644
--- a/chrome/browser/views/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/views/find_bar_host_interactive_uitest.cc
@@ -49,7 +49,7 @@ class FindInPageTest : public InProcessBrowserTest {
ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
new MessageLoop::QuitTask());
- ui_test_utils::RunMessageLoop();
+ ASSERT_NO_FATAL_FAILURE(ui_test_utils::RunMessageLoop());
}
int GetFocusedViewID() {
@@ -113,17 +113,16 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) {
browser()->CloseTabContents(browser()->GetTabContentsAt(1));
// Click on the location bar so that Find box loses focus.
- ClickOnView(VIEW_ID_LOCATION_BAR);
+ ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_LOCATION_BAR));
#if defined(TOOLKIT_VIEWS) || defined(OS_WIN)
// Check the location bar is focused.
EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID());
#endif
// This used to crash until bug 1303709 was fixed.
- ui_controls::SendKeyPressNotifyWhenDone(
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
browser()->window()->GetNativeHandle(), base::VKEY_ESCAPE,
- false, false, false, false, new MessageLoop::QuitTask());
- ui_test_utils::RunMessageLoop();
+ false, false, false, false));
}
IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestore) {
@@ -187,28 +186,22 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, PrepopulateRespectBlank) {
browser()->GetFindBarController()->Show();
// Search for "a".
- ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_A,
- false, false, false, false, // No modifiers.
- new MessageLoop::QuitTask());
- ui_test_utils::RunMessageLoop();
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
+ window, base::VKEY_A, false, false, false, false)); // No modifiers
// We should find "a" here.
EXPECT_EQ(ASCIIToUTF16("a"), GetFindBarText());
// Delete "a".
- ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_BACK,
- false, false, false, false, // No modifiers.
- new MessageLoop::QuitTask());
- ui_test_utils::RunMessageLoop();
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
+ window, base::VKEY_BACK, false, false, false, false)); // No modifiers.
// Validate we have cleared the text.
EXPECT_EQ(string16(), GetFindBarText());
// Close the Find box.
- ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_ESCAPE,
- false, false, false, false, // No modifiers.
- new MessageLoop::QuitTask());
- ui_test_utils::RunMessageLoop();
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
+ window, base::VKEY_ESCAPE, false, false, false, false)); // No modifiers.
// Show the Find bar.
browser()->GetFindBarController()->Show();
@@ -218,16 +211,12 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, PrepopulateRespectBlank) {
EXPECT_EQ(string16(), GetFindBarText());
// Close the Find box.
- ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_ESCAPE,
- false, false, false, false, // No modifiers.
- new MessageLoop::QuitTask());
- ui_test_utils::RunMessageLoop();
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
+ window, base::VKEY_ESCAPE, false, false, false, false)); // No modifiers.
// Press F3 to trigger FindNext.
- ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_F3,
- false, false, false, false, // No modifiers.
- new MessageLoop::QuitTask());
- ui_test_utils::RunMessageLoop();
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
+ window, base::VKEY_F3, false, false, false, false)); // No modifiers.
// After the Find box has been reopened, it should still have no prepopulate
// value.

Powered by Google App Engine
This is Rietveld 408576698