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 "ash/focus_cycler.h" | 5 #include "ash/focus_cycler.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 class PanedWidgetDelegate : public views::WidgetDelegate { | 37 class PanedWidgetDelegate : public views::WidgetDelegate { |
38 public: | 38 public: |
39 PanedWidgetDelegate(views::Widget* widget) : widget_(widget) {} | 39 PanedWidgetDelegate(views::Widget* widget) : widget_(widget) {} |
40 | 40 |
41 void SetAccessiblePanes(const std::vector<views::View*>& panes) { | 41 void SetAccessiblePanes(const std::vector<views::View*>& panes) { |
42 accessible_panes_ = panes; | 42 accessible_panes_ = panes; |
43 } | 43 } |
44 | 44 |
45 // views::WidgetDelegate. | 45 // views::WidgetDelegate. |
46 virtual void GetAccessiblePanes(std::vector<views::View*>* panes) override { | 46 void GetAccessiblePanes(std::vector<views::View*>* panes) override { |
47 std::copy(accessible_panes_.begin(), | 47 std::copy(accessible_panes_.begin(), |
48 accessible_panes_.end(), | 48 accessible_panes_.end(), |
49 std::back_inserter(*panes)); | 49 std::back_inserter(*panes)); |
50 } | 50 } |
51 virtual views::Widget* GetWidget() override { | 51 views::Widget* GetWidget() override { return widget_; }; |
52 return widget_; | 52 const views::Widget* GetWidget() const override { return widget_; } |
53 }; | |
54 virtual const views::Widget* GetWidget() const override { | |
55 return widget_; | |
56 } | |
57 | 53 |
58 private: | 54 private: |
59 views::Widget* widget_; | 55 views::Widget* widget_; |
60 std::vector<views::View*> accessible_panes_; | 56 std::vector<views::View*> accessible_panes_; |
61 }; | 57 }; |
62 | 58 |
63 } // namespace | 59 } // namespace |
64 | 60 |
65 class FocusCyclerTest : public AshTestBase { | 61 class FocusCyclerTest : public AshTestBase { |
66 public: | 62 public: |
67 FocusCyclerTest() {} | 63 FocusCyclerTest() {} |
68 | 64 |
69 virtual void SetUp() override { | 65 void SetUp() override { |
70 AshTestBase::SetUp(); | 66 AshTestBase::SetUp(); |
71 | 67 |
72 focus_cycler_.reset(new FocusCycler()); | 68 focus_cycler_.reset(new FocusCycler()); |
73 | 69 |
74 ASSERT_TRUE(Shelf::ForPrimaryDisplay()); | 70 ASSERT_TRUE(Shelf::ForPrimaryDisplay()); |
75 } | 71 } |
76 | 72 |
77 virtual void TearDown() override { | 73 void TearDown() override { |
78 if (tray_) { | 74 if (tray_) { |
79 GetStatusAreaWidgetDelegate(tray_->GetWidget())-> | 75 GetStatusAreaWidgetDelegate(tray_->GetWidget())-> |
80 SetFocusCyclerForTesting(NULL); | 76 SetFocusCyclerForTesting(NULL); |
81 tray_.reset(); | 77 tray_.reset(); |
82 } | 78 } |
83 | 79 |
84 shelf_widget()->SetFocusCycler(NULL); | 80 shelf_widget()->SetFocusCycler(NULL); |
85 | 81 |
86 focus_cycler_.reset(); | 82 focus_cycler_.reset(); |
87 | 83 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // should do the same thing. | 394 // should do the same thing. |
399 focus_cycler()->RotateFocus(FocusCycler::BACKWARD); | 395 focus_cycler()->RotateFocus(FocusCycler::BACKWARD); |
400 EXPECT_TRUE(shelf_widget()->IsActive()); | 396 EXPECT_TRUE(shelf_widget()->IsActive()); |
401 event_generator.PressKey(ui::VKEY_ESCAPE, 0); | 397 event_generator.PressKey(ui::VKEY_ESCAPE, 0); |
402 EXPECT_TRUE(wm::IsActiveWindow(browser_window)); | 398 EXPECT_TRUE(wm::IsActiveWindow(browser_window)); |
403 EXPECT_EQ(focus_manager->GetFocusedView(), view1); | 399 EXPECT_EQ(focus_manager->GetFocusedView(), view1); |
404 } | 400 } |
405 | 401 |
406 } // namespace test | 402 } // namespace test |
407 } // namespace ash | 403 } // namespace ash |
OLD | NEW |