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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_browsertest.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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/automation/ui_controls.h » ('j') | chrome/test/ui_test_utils.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/keyboard_codes.h" 7 #include "base/keyboard_codes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/platform_thread.h" 10 #include "base/platform_thread.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 ASSERT_TRUE(window); 118 ASSERT_TRUE(window);
119 LocationBar* loc_bar = window->GetLocationBar(); 119 LocationBar* loc_bar = window->GetLocationBar();
120 ASSERT_TRUE(loc_bar); 120 ASSERT_TRUE(loc_bar);
121 *edit_view = loc_bar->location_entry(); 121 *edit_view = loc_bar->location_entry();
122 ASSERT_TRUE(*edit_view); 122 ASSERT_TRUE(*edit_view);
123 } 123 }
124 124
125 void SendKey(base::KeyboardCode key, bool control, bool shift, bool alt) { 125 void SendKey(base::KeyboardCode key, bool control, bool shift, bool alt) {
126 gfx::NativeWindow window = NULL; 126 gfx::NativeWindow window = NULL;
127 ASSERT_NO_FATAL_FAILURE(GetNativeWindow(&window)); 127 ASSERT_NO_FATAL_FAILURE(GetNativeWindow(&window));
128 ui_controls::SendKeyPressNotifyWhenDone(window, key, control, shift, alt, 128 ASSERT_TRUE(
129 false /* command */, 129 ui_test_utils::SendKeyPressSync(
130 new MessageLoop::QuitTask()); 130 window, key, control, shift, alt, false /* command */));
131 ui_test_utils::RunMessageLoop();
132 } 131 }
133 132
134 void SendKeySequence(const wchar_t* keys) { 133 void SendKeySequence(const wchar_t* keys) {
135 for (; *keys; ++keys) 134 for (; *keys; ++keys)
136 ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<base::KeyboardCode>(*keys), 135 ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<base::KeyboardCode>(*keys),
137 false, false, false)); 136 false, false, false));
138 } 137 }
139 138
140 void WaitForTabOpenOrClose(int expected_tab_count) { 139 void WaitForTabOpenOrClose(int expected_tab_count) {
141 int tab_count = browser()->tab_count(); 140 int tab_count = browser()->tab_count();
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 break; 541 break;
543 } 542 }
544 543
545 EXPECT_NE(old_text, edit_view->GetText()); 544 EXPECT_NE(old_text, edit_view->GetText());
546 545
547 // Escape shall revert back to the default match item. 546 // Escape shall revert back to the default match item.
548 ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_ESCAPE, false, false, false)); 547 ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_ESCAPE, false, false, false));
549 EXPECT_EQ(old_text, edit_view->GetText()); 548 EXPECT_EQ(old_text, edit_view->GetText());
550 EXPECT_EQ(old_selected_line, popup_model->selected_line()); 549 EXPECT_EQ(old_selected_line, popup_model->selected_line());
551 } 550 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/ui_controls.h » ('j') | chrome/test/ui_test_utils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698