| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/keyboard_codes.h" | 8 #include "base/keyboard_codes.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 LocationBar* loc_bar = window->GetLocationBar(); | 118 LocationBar* loc_bar = window->GetLocationBar(); |
| 119 ASSERT_TRUE(loc_bar); | 119 ASSERT_TRUE(loc_bar); |
| 120 *edit_view = loc_bar->location_entry(); | 120 *edit_view = loc_bar->location_entry(); |
| 121 ASSERT_TRUE(*edit_view); | 121 ASSERT_TRUE(*edit_view); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void SendKey(base::KeyboardCode key, bool control, bool shift, bool alt) { | 124 void SendKey(base::KeyboardCode key, bool control, bool shift, bool alt) { |
| 125 gfx::NativeWindow window = NULL; | 125 gfx::NativeWindow window = NULL; |
| 126 ASSERT_NO_FATAL_FAILURE(GetNativeWindow(&window)); | 126 ASSERT_NO_FATAL_FAILURE(GetNativeWindow(&window)); |
| 127 ui_controls::SendKeyPressNotifyWhenDone(window, key, control, shift, alt, | 127 ui_controls::SendKeyPressNotifyWhenDone(window, key, control, shift, alt, |
| 128 false /* command */, |
| 128 new MessageLoop::QuitTask()); | 129 new MessageLoop::QuitTask()); |
| 129 ui_test_utils::RunMessageLoop(); | 130 ui_test_utils::RunMessageLoop(); |
| 130 } | 131 } |
| 131 | 132 |
| 132 void SendKeySequence(const wchar_t* keys) { | 133 void SendKeySequence(const wchar_t* keys) { |
| 133 for (; *keys; ++keys) | 134 for (; *keys; ++keys) |
| 134 ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<base::KeyboardCode>(*keys), | 135 ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<base::KeyboardCode>(*keys), |
| 135 false, false, false)); | 136 false, false, false)); |
| 136 } | 137 } |
| 137 | 138 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 break; | 540 break; |
| 540 } | 541 } |
| 541 | 542 |
| 542 EXPECT_NE(old_text, edit_view->GetText()); | 543 EXPECT_NE(old_text, edit_view->GetText()); |
| 543 | 544 |
| 544 // Escape shall revert back to the default match item. | 545 // Escape shall revert back to the default match item. |
| 545 ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_ESCAPE, false, false, false)); | 546 ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_ESCAPE, false, false, false)); |
| 546 EXPECT_EQ(old_text, edit_view->GetText()); | 547 EXPECT_EQ(old_text, edit_view->GetText()); |
| 547 EXPECT_EQ(old_selected_line, popup_model->selected_line()); | 548 EXPECT_EQ(old_selected_line, popup_model->selected_line()); |
| 548 } | 549 } |
| OLD | NEW |