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

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

Issue 404203003: Distinguish between keystroke and character events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IsCharFromNative() for Mac build Created 6 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
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/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 void ResetAutoLaunchTimeout() { 78 void ResetAutoLaunchTimeout() {
79 view_delegate_.set_auto_launch_timeout(base::TimeDelta()); 79 view_delegate_.set_auto_launch_timeout(base::TimeDelta());
80 } 80 }
81 81
82 int GetContentsViewKeyPressCountAndReset() { 82 int GetContentsViewKeyPressCountAndReset() {
83 return counter_view_->GetCountAndReset(); 83 return counter_view_->GetCountAndReset();
84 } 84 }
85 85
86 void KeyPress(ui::KeyboardCode key_code) { 86 void KeyPress(ui::KeyboardCode key_code) {
87 ui::KeyEvent event(ui::ET_KEY_PRESSED, key_code, ui::EF_NONE, true); 87 ui::KeyEvent event(ui::ET_KEY_PRESSED, key_code, ui::EF_NONE);
88 view_->search_box()->OnKeyPressed(event); 88 view_->search_box()->OnKeyPressed(event);
89 // Emulates the input method. 89 // Emulates the input method.
90 if (::isalnum(static_cast<int>(key_code))) { 90 if (::isalnum(static_cast<int>(key_code))) {
91 base::char16 character = ::tolower(static_cast<int>(key_code)); 91 base::char16 character = ::tolower(static_cast<int>(key_code));
92 view_->search_box()->InsertText(base::string16(1, character)); 92 view_->search_box()->InsertText(base::string16(1, character));
93 } 93 }
94 } 94 }
95 95
96 std::string GetLastQueryAndReset() { 96 std::string GetLastQueryAndReset() {
97 base::string16 query = last_query_; 97 base::string16 query = last_query_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ResetAutoLaunchTimeout(); 154 ResetAutoLaunchTimeout();
155 155
156 // Clearing search box also cancels. 156 // Clearing search box also cancels.
157 SetLongAutoLaunchTimeout(); 157 SetLongAutoLaunchTimeout();
158 view()->ClearSearch(); 158 view()->ClearSearch();
159 EXPECT_EQ(base::TimeDelta(), GetAutoLaunchTimeout()); 159 EXPECT_EQ(base::TimeDelta(), GetAutoLaunchTimeout());
160 } 160 }
161 161
162 } // namespace test 162 } // namespace test
163 } // namespace app_list 163 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/apps_grid_view_unittest.cc ('k') | ui/app_list/views/search_result_list_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698