| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 content::TestBrowserThreadBundle thread_bundle_; | 114 content::TestBrowserThreadBundle thread_bundle_; |
| 115 TestingProfile profile_; | 115 TestingProfile profile_; |
| 116 CommandUpdater command_updater_; | 116 CommandUpdater command_updater_; |
| 117 TestingOmniboxEditController omnibox_edit_controller_; | 117 TestingOmniboxEditController omnibox_edit_controller_; |
| 118 scoped_ptr<TestingOmniboxViewViews> omnibox_view_; | 118 scoped_ptr<TestingOmniboxViewViews> omnibox_view_; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 // Checks that a single change of the text in the omnibox invokes | 121 // Checks that a single change of the text in the omnibox invokes |
| 122 // only one call to OmniboxViewViews::UpdatePopup(). | 122 // only one call to OmniboxViewViews::UpdatePopup(). |
| 123 TEST_F(OmniboxViewViewsTest, UpdatePopupCall) { | 123 TEST_F(OmniboxViewViewsTest, UpdatePopupCall) { |
| 124 ui::KeyEvent char_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::KEY_A, 0, | 124 ui::KeyEvent char_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::US_A, 0, |
| 125 ui::DomKey::FromCharacter('a'), | 125 ui::DomKey::FromCharacter('a'), |
| 126 ui::EventTimeForNow()); | 126 ui::EventTimeForNow()); |
| 127 omnibox_textfield()->InsertChar(char_event); | 127 omnibox_textfield()->InsertChar(char_event); |
| 128 omnibox_view()->CheckUpdatePopupCallInfo( | 128 omnibox_view()->CheckUpdatePopupCallInfo( |
| 129 1, base::ASCIIToUTF16("a"), gfx::Range(1)); | 129 1, base::ASCIIToUTF16("a"), gfx::Range(1)); |
| 130 | 130 |
| 131 char_event = | 131 char_event = |
| 132 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_B, ui::DomCode::KEY_B, 0, | 132 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_B, ui::DomCode::US_B, 0, |
| 133 ui::DomKey::FromCharacter('b'), ui::EventTimeForNow()); | 133 ui::DomKey::FromCharacter('b'), ui::EventTimeForNow()); |
| 134 omnibox_textfield()->InsertChar(char_event); | 134 omnibox_textfield()->InsertChar(char_event); |
| 135 omnibox_view()->CheckUpdatePopupCallInfo( | 135 omnibox_view()->CheckUpdatePopupCallInfo( |
| 136 2, base::ASCIIToUTF16("ab"), gfx::Range(2)); | 136 2, base::ASCIIToUTF16("ab"), gfx::Range(2)); |
| 137 | 137 |
| 138 ui::KeyEvent pressed(ui::ET_KEY_PRESSED, ui::VKEY_BACK, 0); | 138 ui::KeyEvent pressed(ui::ET_KEY_PRESSED, ui::VKEY_BACK, 0); |
| 139 omnibox_textfield()->OnKeyPressed(pressed); | 139 omnibox_textfield()->OnKeyPressed(pressed); |
| 140 omnibox_view()->CheckUpdatePopupCallInfo( | 140 omnibox_view()->CheckUpdatePopupCallInfo( |
| 141 3, base::ASCIIToUTF16("a"), gfx::Range(1)); | 141 3, base::ASCIIToUTF16("a"), gfx::Range(1)); |
| 142 } | 142 } |
| OLD | NEW |