| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/accessible_pane_view.h" | 5 #include "ui/views/accessible_pane_view.h" |
| 6 | 6 |
| 7 #include "ui/base/accelerators/accelerator.h" | 7 #include "ui/base/accelerators/accelerator.h" |
| 8 #include "ui/views/controls/button/label_button.h" | 8 #include "ui/views/controls/button/label_button.h" |
| 9 #include "ui/views/layout/fill_layout.h" | 9 #include "ui/views/layout/fill_layout.h" |
| 10 #include "ui/views/test/views_test_base.h" | 10 #include "ui/views/test/views_test_base.h" |
| 11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 // TODO(alicet): bring pane rotation into views and add tests. | 15 // TODO(alicet): bring pane rotation into views and add tests. |
| 16 // See browser_view.cc for details. | 16 // See browser_view.cc for details. |
| 17 | 17 |
| 18 typedef ViewsTestBase AccessiblePaneViewTest; | 18 typedef ViewsTestBase AccessiblePaneViewTest; |
| 19 | 19 |
| 20 class TestBarView : public AccessiblePaneView, | 20 class TestBarView : public AccessiblePaneView, |
| 21 public ButtonListener { | 21 public ButtonListener { |
| 22 public: | 22 public: |
| 23 TestBarView(); | 23 TestBarView(); |
| 24 virtual ~TestBarView(); | 24 ~TestBarView() override; |
| 25 | 25 |
| 26 virtual void ButtonPressed(Button* sender, | 26 void ButtonPressed(Button* sender, const ui::Event& event) override; |
| 27 const ui::Event& event) override; | |
| 28 LabelButton* child_button() const { return child_button_.get(); } | 27 LabelButton* child_button() const { return child_button_.get(); } |
| 29 LabelButton* second_child_button() const { | 28 LabelButton* second_child_button() const { |
| 30 return second_child_button_.get(); | 29 return second_child_button_.get(); |
| 31 } | 30 } |
| 32 LabelButton* third_child_button() const { return third_child_button_.get(); } | 31 LabelButton* third_child_button() const { return third_child_button_.get(); } |
| 33 LabelButton* not_child_button() const { return not_child_button_.get(); } | 32 LabelButton* not_child_button() const { return not_child_button_.get(); } |
| 34 | 33 |
| 35 virtual View* GetDefaultFocusableChild() override; | 34 View* GetDefaultFocusableChild() override; |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 void Init(); | 37 void Init(); |
| 39 | 38 |
| 40 scoped_ptr<LabelButton> child_button_; | 39 scoped_ptr<LabelButton> child_button_; |
| 41 scoped_ptr<LabelButton> second_child_button_; | 40 scoped_ptr<LabelButton> second_child_button_; |
| 42 scoped_ptr<LabelButton> third_child_button_; | 41 scoped_ptr<LabelButton> third_child_button_; |
| 43 scoped_ptr<LabelButton> not_child_button_; | 42 scoped_ptr<LabelButton> not_child_button_; |
| 44 | 43 |
| 45 DISALLOW_COPY_AND_ASSIGN(TestBarView); | 44 DISALLOW_COPY_AND_ASSIGN(TestBarView); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 test_view->GetWidget()->GetFocusManager()->GetFocusedView()); | 214 test_view->GetWidget()->GetFocusManager()->GetFocusedView()); |
| 216 | 215 |
| 217 // ESC | 216 // ESC |
| 218 test_view->AcceleratorPressed(test_view->escape_key()); | 217 test_view->AcceleratorPressed(test_view->escape_key()); |
| 219 EXPECT_EQ(original_test_view->third_child_button(), | 218 EXPECT_EQ(original_test_view->third_child_button(), |
| 220 test_view->GetWidget()->GetFocusManager()->GetFocusedView()); | 219 test_view->GetWidget()->GetFocusManager()->GetFocusedView()); |
| 221 widget->CloseNow(); | 220 widget->CloseNow(); |
| 222 widget.reset(); | 221 widget.reset(); |
| 223 } | 222 } |
| 224 } // namespace views | 223 } // namespace views |
| OLD | NEW |