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/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 virtual void SetUp() OVERRIDE { | 43 virtual void SetUp() OVERRIDE { |
44 AshTestBase::SetUp(); | 44 AshTestBase::SetUp(); |
45 | 45 |
46 focus_cycler_.reset(new FocusCycler()); | 46 focus_cycler_.reset(new FocusCycler()); |
47 | 47 |
48 ASSERT_TRUE(Launcher::ForPrimaryDisplay()); | 48 ASSERT_TRUE(Launcher::ForPrimaryDisplay()); |
49 } | 49 } |
50 | 50 |
51 virtual void TearDown() OVERRIDE { | 51 virtual void TearDown() OVERRIDE { |
52 if (tray_.get()) { | 52 if (tray_) { |
53 GetStatusAreaWidgetDelegate(tray_->GetWidget())-> | 53 GetStatusAreaWidgetDelegate(tray_->GetWidget())-> |
54 SetFocusCyclerForTesting(NULL); | 54 SetFocusCyclerForTesting(NULL); |
55 tray_.reset(); | 55 tray_.reset(); |
56 } | 56 } |
57 | 57 |
58 shelf_widget()->SetFocusCycler(NULL); | 58 shelf_widget()->SetFocusCycler(NULL); |
59 | 59 |
60 focus_cycler_.reset(); | 60 focus_cycler_.reset(); |
61 | 61 |
62 AshTestBase::TearDown(); | 62 AshTestBase::TearDown(); |
63 } | 63 } |
64 | 64 |
65 protected: | 65 protected: |
66 // Creates the system tray, returning true on success. | 66 // Creates the system tray, returning true on success. |
67 bool CreateTray() { | 67 bool CreateTray() { |
68 if (tray_.get()) | 68 if (tray_) |
69 return false; | 69 return false; |
70 aura::Window* parent = Shell::GetPrimaryRootWindowController()-> | 70 aura::Window* parent = Shell::GetPrimaryRootWindowController()-> |
71 GetContainer(ash::internal::kShellWindowId_StatusContainer); | 71 GetContainer(ash::internal::kShellWindowId_StatusContainer); |
72 | 72 |
73 internal::StatusAreaWidget* widget = new internal::StatusAreaWidget(parent); | 73 internal::StatusAreaWidget* widget = new internal::StatusAreaWidget(parent); |
74 widget->CreateTrayViews(); | 74 widget->CreateTrayViews(); |
75 widget->Show(); | 75 widget->Show(); |
76 tray_.reset(widget->system_tray()); | 76 tray_.reset(widget->system_tray()); |
77 if (!tray_->GetWidget()) | 77 if (!tray_->GetWidget()) |
78 return false; | 78 return false; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 focus_cycler()->RotateFocus(FocusCycler::BACKWARD); | 256 focus_cycler()->RotateFocus(FocusCycler::BACKWARD); |
257 EXPECT_TRUE(tray()->GetWidget()->IsActive()); | 257 EXPECT_TRUE(tray()->GetWidget()->IsActive()); |
258 | 258 |
259 // Cycle focus to the browser. | 259 // Cycle focus to the browser. |
260 focus_cycler()->RotateFocus(FocusCycler::BACKWARD); | 260 focus_cycler()->RotateFocus(FocusCycler::BACKWARD); |
261 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 261 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
262 } | 262 } |
263 | 263 |
264 } // namespace test | 264 } // namespace test |
265 } // namespace ash | 265 } // namespace ash |
OLD | NEW |