| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |