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 "ash/session/session_state_delegate.h" | 5 #include "ash/session/session_state_delegate.h" |
6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/test/ash_test_helper.h" | 9 #include "ash/test/ash_test_helper.h" |
10 #include "ash/test/test_session_state_delegate.h" | 10 #include "ash/test/test_session_state_delegate.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 params.parent = Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 61 params.parent = Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
62 kShellWindowId_LockScreenContainer); | 62 kShellWindowId_LockScreenContainer); |
63 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 63 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
64 lock_screen_widget_->Init(params); | 64 lock_screen_widget_->Init(params); |
65 lock_screen_widget_->SetContentsView(lock_view); | 65 lock_screen_widget_->SetContentsView(lock_view); |
66 lock_screen_widget_->Show(); | 66 lock_screen_widget_->Show(); |
67 lock_screen_widget_->GetNativeView()->SetName("LockView"); | 67 lock_screen_widget_->GetNativeView()->SetName("LockView"); |
68 lock_screen_widget_->GetNativeView()->Focus(); | 68 lock_screen_widget_->GetNativeView()->Focus(); |
69 } | 69 } |
70 | 70 |
71 scoped_ptr<views::Widget> lock_screen_widget_; | 71 std::unique_ptr<views::Widget> lock_screen_widget_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(LockScreenSessionStateDelegate); | 73 DISALLOW_COPY_AND_ASSIGN(LockScreenSessionStateDelegate); |
74 }; | 74 }; |
75 | 75 |
76 //////////////////////////////////////////////////////////////////////////////// | 76 //////////////////////////////////////////////////////////////////////////////// |
77 | 77 |
78 // Defines a |ShellDelegate| that is used to construct our lock screen | 78 // Defines a |ShellDelegate| that is used to construct our lock screen |
79 // |SessionStateDelegate|. | 79 // |SessionStateDelegate|. |
80 class LockScreenShellDelegate : public test::TestShellDelegate { | 80 class LockScreenShellDelegate : public test::TestShellDelegate { |
81 public: | 81 public: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(LockScreenAshFocusRulesTest); | 140 DISALLOW_COPY_AND_ASSIGN(LockScreenAshFocusRulesTest); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace | 143 } // namespace |
144 | 144 |
145 // Verifies focus is returned (after unlocking the screen) to the most recent | 145 // Verifies focus is returned (after unlocking the screen) to the most recent |
146 // window that had it before locking the screen. | 146 // window that had it before locking the screen. |
147 TEST_F(LockScreenAshFocusRulesTest, RegainFocusAfterUnlock) { | 147 TEST_F(LockScreenAshFocusRulesTest, RegainFocusAfterUnlock) { |
148 scoped_ptr<aura::Window> normal_window(CreateWindowInDefaultContainer()); | 148 std::unique_ptr<aura::Window> normal_window(CreateWindowInDefaultContainer()); |
149 scoped_ptr<aura::Window> always_on_top_window( | 149 std::unique_ptr<aura::Window> always_on_top_window( |
150 CreateWindowInAlwaysOnTopContainer()); | 150 CreateWindowInAlwaysOnTopContainer()); |
151 | 151 |
152 wm::ActivateWindow(always_on_top_window.get()); | 152 wm::ActivateWindow(always_on_top_window.get()); |
153 wm::ActivateWindow(normal_window.get()); | 153 wm::ActivateWindow(normal_window.get()); |
154 | 154 |
155 EXPECT_TRUE(wm::IsActiveWindow(normal_window.get())); | 155 EXPECT_TRUE(wm::IsActiveWindow(normal_window.get())); |
156 EXPECT_TRUE(normal_window->IsVisible()); | 156 EXPECT_TRUE(normal_window->IsVisible()); |
157 EXPECT_TRUE(always_on_top_window->IsVisible()); | 157 EXPECT_TRUE(always_on_top_window->IsVisible()); |
158 EXPECT_TRUE(normal_window->HasFocus()); | 158 EXPECT_TRUE(normal_window->HasFocus()); |
159 EXPECT_FALSE(always_on_top_window->HasFocus()); | 159 EXPECT_FALSE(always_on_top_window->HasFocus()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 EXPECT_FALSE(delegate.view()->HasFocus()); | 200 EXPECT_FALSE(delegate.view()->HasFocus()); |
201 | 201 |
202 UnblockUserSession(); | 202 UnblockUserSession(); |
203 EXPECT_FALSE(shell()->session_state_delegate()->IsScreenLocked()); | 203 EXPECT_FALSE(shell()->session_state_delegate()->IsScreenLocked()); |
204 EXPECT_TRUE(delegate.GetWidget()->IsActive()); | 204 EXPECT_TRUE(delegate.GetWidget()->IsActive()); |
205 EXPECT_TRUE(delegate.view()->HasFocus()); | 205 EXPECT_TRUE(delegate.view()->HasFocus()); |
206 } | 206 } |
207 | 207 |
208 } // namespace test | 208 } // namespace test |
209 } // namespace ash | 209 } // namespace ash |
OLD | NEW |