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

Side by Side Diff: ui/app_list/views/search_box_view_unittest.cc

Issue 2273263002: MacViewsBrowser: Fix omnibox crash due to failed DCHECK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review, make Textfield::OnKeyPressed/Released final. Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/app_list/views/search_box_view.h" 5 #include "ui/app_list/views/search_box_view.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void ResetAutoLaunchTimeout() { 79 void ResetAutoLaunchTimeout() {
80 view_delegate_.set_auto_launch_timeout(base::TimeDelta()); 80 view_delegate_.set_auto_launch_timeout(base::TimeDelta());
81 } 81 }
82 82
83 int GetContentsViewKeyPressCountAndReset() { 83 int GetContentsViewKeyPressCountAndReset() {
84 return counter_view_->GetCountAndReset(); 84 return counter_view_->GetCountAndReset();
85 } 85 }
86 86
87 void KeyPress(ui::KeyboardCode key_code) { 87 void KeyPress(ui::KeyboardCode key_code) {
88 ui::KeyEvent event(ui::ET_KEY_PRESSED, key_code, ui::EF_NONE); 88 ui::KeyEvent event(ui::ET_KEY_PRESSED, key_code, ui::EF_NONE);
89 view_->search_box()->OnKeyPressed(event); 89 view_->search_box()->OnKeyEvent(&event);
90 // Emulates the input method. 90 // Emulates the input method.
91 if (::isalnum(static_cast<int>(key_code))) { 91 if (::isalnum(static_cast<int>(key_code))) {
92 base::char16 character = ::tolower(static_cast<int>(key_code)); 92 base::char16 character = ::tolower(static_cast<int>(key_code));
93 view_->search_box()->InsertText(base::string16(1, character)); 93 view_->search_box()->InsertText(base::string16(1, character));
94 } 94 }
95 } 95 }
96 96
97 std::string GetLastQueryAndReset() { 97 std::string GetLastQueryAndReset() {
98 base::string16 query = last_query_; 98 base::string16 query = last_query_;
99 last_query_.clear(); 99 last_query_.clear();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 ResetAutoLaunchTimeout(); 159 ResetAutoLaunchTimeout();
160 160
161 // Clearing search box also cancels. 161 // Clearing search box also cancels.
162 SetLongAutoLaunchTimeout(); 162 SetLongAutoLaunchTimeout();
163 view()->ClearSearch(); 163 view()->ClearSearch();
164 EXPECT_EQ(base::TimeDelta(), GetAutoLaunchTimeout()); 164 EXPECT_EQ(base::TimeDelta(), GetAutoLaunchTimeout());
165 } 165 }
166 166
167 } // namespace test 167 } // namespace test
168 } // namespace app_list 168 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698