OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/accessible_pane_view.h" | 5 #include "views/accessible_pane_view.h" |
6 | 6 |
| 7 #include "ui/base/models/accelerator.h" |
7 #include "views/controls/button/text_button.h" | 8 #include "views/controls/button/text_button.h" |
8 #include "views/layout/fill_layout.h" | 9 #include "views/layout/fill_layout.h" |
9 #include "views/test/views_test_base.h" | 10 #include "views/test/views_test_base.h" |
10 #include "views/widget/widget.h" | 11 #include "views/widget/widget.h" |
11 | 12 |
12 namespace views { | 13 namespace views { |
13 | 14 |
14 // TODO(alicet): bring pane rotation into views and add tests. | 15 // TODO(alicet): bring pane rotation into views and add tests. |
15 // See browser_view.cc for details. | 16 // See browser_view.cc for details. |
16 | 17 |
17 typedef ViewsTestBase AccessiblePaneViewTest; | 18 typedef ViewsTestBase AccessiblePaneViewTest; |
18 | 19 |
19 class TestBarView : public AccessiblePaneView, | 20 class TestBarView : public AccessiblePaneView, |
20 public ButtonListener { | 21 public ButtonListener { |
21 public: | 22 public: |
22 TestBarView(); | 23 TestBarView(); |
23 virtual ~TestBarView(); | 24 virtual ~TestBarView(); |
24 | 25 |
25 virtual void ButtonPressed(Button* sender, | 26 virtual void ButtonPressed(Button* sender, |
26 const views::Event& event) OVERRIDE; | 27 const views::Event& event) OVERRIDE; |
27 TextButton* child_button() const { return child_button_.get(); } | 28 TextButton* child_button() const { return child_button_.get(); } |
28 TextButton* second_child_button() const { return second_child_button_.get(); } | 29 TextButton* second_child_button() const { return second_child_button_.get(); } |
29 TextButton* third_child_button() const { return third_child_button_.get(); } | 30 TextButton* third_child_button() const { return third_child_button_.get(); } |
30 TextButton* not_child_button() const { return not_child_button_.get(); } | 31 TextButton* not_child_button() const { return not_child_button_.get(); } |
31 | 32 |
32 const Accelerator& home_key() const { return home_key_; } | 33 const ui::Accelerator& home_key() const { return home_key_; } |
33 const Accelerator& end_key() const { return end_key_; } | 34 const ui::Accelerator& end_key() const { return end_key_; } |
34 const Accelerator& escape_key() const { return escape_key_; } | 35 const ui::Accelerator& escape_key() const { return escape_key_; } |
35 const Accelerator& left_key() const { return left_key_; } | 36 const ui::Accelerator& left_key() const { return left_key_; } |
36 const Accelerator& right_key() const { return right_key_; } | 37 const ui::Accelerator& right_key() const { return right_key_; } |
37 | 38 |
38 virtual View* GetDefaultFocusableChild() OVERRIDE; | 39 virtual View* GetDefaultFocusableChild() OVERRIDE; |
39 | 40 |
40 private: | 41 private: |
41 void Init(); | 42 void Init(); |
42 | 43 |
43 scoped_ptr<TextButton> child_button_; | 44 scoped_ptr<TextButton> child_button_; |
44 scoped_ptr<TextButton> second_child_button_; | 45 scoped_ptr<TextButton> second_child_button_; |
45 scoped_ptr<TextButton> third_child_button_; | 46 scoped_ptr<TextButton> third_child_button_; |
46 scoped_ptr<TextButton> not_child_button_; | 47 scoped_ptr<TextButton> not_child_button_; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 test_view->GetWidget()->GetFocusManager()->GetFocusedView()); | 169 test_view->GetWidget()->GetFocusManager()->GetFocusedView()); |
169 | 170 |
170 // ESC | 171 // ESC |
171 test_view->AcceleratorPressed(test_view->escape_key()); | 172 test_view->AcceleratorPressed(test_view->escape_key()); |
172 EXPECT_EQ(original_test_view->third_child_button(), | 173 EXPECT_EQ(original_test_view->third_child_button(), |
173 test_view->GetWidget()->GetFocusManager()->GetFocusedView()); | 174 test_view->GetWidget()->GetFocusManager()->GetFocusedView()); |
174 widget->CloseNow(); | 175 widget->CloseNow(); |
175 widget.reset(); | 176 widget.reset(); |
176 } | 177 } |
177 } // namespace views | 178 } // namespace views |
OLD | NEW |