Chromium Code Reviews| 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" |
| 11 #include "ash/test/test_shell_delegate.h" | 11 #include "ash/test/test_shell_delegate.h" |
| 12 #include "ash/wm/lock_state_controller.h" | 12 #include "ash/wm/lock_state_controller.h" |
| 13 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
| 14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 15 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/client/window_tree_client.h" | 16 #include "ui/aura/client/window_tree_client.h" |
| 17 #include "ui/views/test/widget_test.h" | |
| 17 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
| 18 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 namespace test { | 22 namespace test { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // Defines a |SessionStateDelegate| that is used to create and destroy the | 26 // Defines a |SessionStateDelegate| that is used to create and destroy the |
| 26 // test lock screen widget. | 27 // test lock screen widget. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 | 180 |
| 180 EXPECT_FALSE(shell()->session_state_delegate()->IsScreenLocked()); | 181 EXPECT_FALSE(shell()->session_state_delegate()->IsScreenLocked()); |
| 181 EXPECT_FALSE(normal_window_state->IsMinimized()); | 182 EXPECT_FALSE(normal_window_state->IsMinimized()); |
| 182 EXPECT_FALSE(always_on_top_window_state->IsMinimized()); | 183 EXPECT_FALSE(always_on_top_window_state->IsMinimized()); |
| 183 EXPECT_TRUE(normal_window_state->CanActivate()); | 184 EXPECT_TRUE(normal_window_state->CanActivate()); |
| 184 EXPECT_TRUE(always_on_top_window_state->CanActivate()); | 185 EXPECT_TRUE(always_on_top_window_state->CanActivate()); |
| 185 EXPECT_FALSE(always_on_top_window->HasFocus()); | 186 EXPECT_FALSE(always_on_top_window->HasFocus()); |
| 186 EXPECT_TRUE(normal_window->HasFocus()); | 187 EXPECT_TRUE(normal_window->HasFocus()); |
| 187 } | 188 } |
| 188 | 189 |
| 190 // Tests that a window doesn't get activated or focused if it shows up beneath | |
| 191 // the lock screen. | |
| 192 TEST_F(LockScreenAshFocusRulesTest, PreventFocusChangeWithLockScreenPresent) { | |
|
sky
2016/03/02 03:41:02
Please add a test close to the code you are changi
xdai1
2016/03/02 21:15:55
I think it needs to be an ash test since it requir
sky
2016/03/02 22:09:09
The code you are changing is in NativeWidgetAura.
| |
| 193 BlockUserSession(BLOCKED_BY_LOCK_SCREEN); | |
| 194 EXPECT_TRUE(shell()->session_state_delegate()->IsScreenLocked()); | |
| 195 | |
| 196 views::test::TestInitialFocusWidgetDelegate delegate( | |
| 197 shell()->GetPrimaryRootWindow()); | |
| 198 EXPECT_FALSE(delegate.view()->HasFocus()); | |
| 199 delegate.GetWidget()->Show(); | |
| 200 EXPECT_FALSE(delegate.view()->HasFocus()); | |
| 201 } | |
| 202 | |
| 189 } // namespace test | 203 } // namespace test |
| 190 } // namespace ash | 204 } // namespace ash |
| OLD | NEW |