OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/views/test/combobox_test_api.h" | 5 #include "ui/views/test/combobox_test_api.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include "base/macros.h" |
7 #include "ui/base/models/menu_model.h" | 10 #include "ui/base/models/menu_model.h" |
8 #include "ui/views/controls/combobox/combobox.h" | 11 #include "ui/views/controls/combobox/combobox.h" |
9 #include "ui/views/controls/menu/menu_runner.h" | 12 #include "ui/views/controls/menu/menu_runner.h" |
10 #include "ui/views/controls/menu/menu_runner_handler.h" | 13 #include "ui/views/controls/menu/menu_runner_handler.h" |
11 #include "ui/views/test/menu_runner_test_api.h" | 14 #include "ui/views/test/menu_runner_test_api.h" |
12 | 15 |
13 namespace views { | 16 namespace views { |
14 namespace test { | 17 namespace test { |
15 namespace { | 18 namespace { |
16 | 19 |
17 // An dummy implementation of MenuRunnerHandler to check if the dropdown menu is | 20 // An dummy implementation of MenuRunnerHandler to check if the dropdown menu is |
18 // shown or not. | 21 // shown or not. |
19 class TestMenuRunnerHandler : public MenuRunnerHandler { | 22 class TestMenuRunnerHandler : public MenuRunnerHandler { |
20 public: | 23 public: |
21 explicit TestMenuRunnerHandler(int* show_counter) | 24 explicit TestMenuRunnerHandler(int* show_counter) |
22 : show_counter_(show_counter) {} | 25 : show_counter_(show_counter) {} |
23 MenuRunner::RunResult RunMenuAt(Widget* parent, | 26 MenuRunner::RunResult RunMenuAt(Widget* parent, |
24 MenuButton* button, | 27 MenuButton* button, |
25 const gfx::Rect& bounds, | 28 const gfx::Rect& bounds, |
26 MenuAnchorPosition anchor, | 29 MenuAnchorPosition anchor, |
27 ui::MenuSourceType source_type, | 30 ui::MenuSourceType source_type, |
28 int32 types) override { | 31 int32_t types) override { |
29 *show_counter_ += 1; | 32 *show_counter_ += 1; |
30 return MenuRunner::NORMAL_EXIT; | 33 return MenuRunner::NORMAL_EXIT; |
31 } | 34 } |
32 | 35 |
33 private: | 36 private: |
34 int* show_counter_; | 37 int* show_counter_; |
35 | 38 |
36 DISALLOW_COPY_AND_ASSIGN(TestMenuRunnerHandler); | 39 DISALLOW_COPY_AND_ASSIGN(TestMenuRunnerHandler); |
37 }; | 40 }; |
38 | 41 |
(...skipping 14 matching lines...) Expand all Loading... |
53 gfx::Size ComboboxTestApi::content_size() { | 56 gfx::Size ComboboxTestApi::content_size() { |
54 return combobox_->content_size_; | 57 return combobox_->content_size_; |
55 } | 58 } |
56 | 59 |
57 ui::MenuModel* ComboboxTestApi::menu_model() { | 60 ui::MenuModel* ComboboxTestApi::menu_model() { |
58 return combobox_->menu_model_adapter_.get(); | 61 return combobox_->menu_model_adapter_.get(); |
59 } | 62 } |
60 | 63 |
61 } // test | 64 } // test |
62 } // views | 65 } // views |
OLD | NEW |