| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/controls/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 focus_manager->OnKeyEvent(event); | 242 focus_manager->OnKeyEvent(event); |
| 243 } | 243 } |
| 244 | 244 |
| 245 View* GetFocusedView() { | 245 View* GetFocusedView() { |
| 246 return widget_->GetFocusManager()->GetFocusedView(); | 246 return widget_->GetFocusManager()->GetFocusedView(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void PerformClick(const gfx::Point& point) { | 249 void PerformClick(const gfx::Point& point) { |
| 250 ui::MouseEvent pressed_event = ui::MouseEvent( | 250 ui::MouseEvent pressed_event = ui::MouseEvent( |
| 251 ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), | 251 ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), |
| 252 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 252 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 253 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 253 widget_->OnMouseEvent(&pressed_event); | 254 widget_->OnMouseEvent(&pressed_event); |
| 254 ui::MouseEvent released_event = ui::MouseEvent( | 255 ui::MouseEvent released_event = ui::MouseEvent( |
| 255 ui::ET_MOUSE_RELEASED, point, point, ui::EventTimeForNow(), | 256 ui::ET_MOUSE_RELEASED, point, point, ui::EventTimeForNow(), |
| 256 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 257 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 258 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 257 widget_->OnMouseEvent(&released_event); | 259 widget_->OnMouseEvent(&released_event); |
| 258 } | 260 } |
| 259 | 261 |
| 260 // We need widget to populate wrapper class. | 262 // We need widget to populate wrapper class. |
| 261 Widget* widget_; | 263 Widget* widget_; |
| 262 | 264 |
| 263 // |combobox_| will be allocated InitCombobox() and then owned by |widget_|. | 265 // |combobox_| will be allocated InitCombobox() and then owned by |widget_|. |
| 264 TestCombobox* combobox_; | 266 TestCombobox* combobox_; |
| 265 | 267 |
| 266 // Combobox does not take ownership of the model, hence it needs to be scoped. | 268 // Combobox does not take ownership of the model, hence it needs to be scoped. |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 combobox_->RequestFocus(); | 688 combobox_->RequestFocus(); |
| 687 | 689 |
| 688 // Type the first character of "PEANUT BUTTER", which should change the | 690 // Type the first character of "PEANUT BUTTER", which should change the |
| 689 // selected index and perform an action. | 691 // selected index and perform an action. |
| 690 input_client->InsertChar('P', ui::EF_NONE); | 692 input_client->InsertChar('P', ui::EF_NONE); |
| 691 EXPECT_EQ(2, listener.actions_performed()); | 693 EXPECT_EQ(2, listener.actions_performed()); |
| 692 EXPECT_EQ(2, listener.perform_action_index()); | 694 EXPECT_EQ(2, listener.perform_action_index()); |
| 693 } | 695 } |
| 694 | 696 |
| 695 } // namespace views | 697 } // namespace views |
| OLD | NEW |