| 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/wm/panel_layout_manager.h" | 5 #include "ash/wm/panel_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/test/launcher_view_test_api.h" | 12 #include "ash/test/launcher_view_test_api.h" |
| 13 #include "ash/test/test_launcher_delegate.h" | 13 #include "ash/test/test_launcher_delegate.h" |
| 14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
| 19 #include "ui/aura/test/test_windows.h" | 19 #include "ui/aura/test/test_windows.h" |
| 20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 #include "ui/views/corewm/corewm_switches.h" |
| 21 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 22 | 23 |
| 23 namespace ash { | 24 namespace ash { |
| 24 namespace internal { | 25 namespace internal { |
| 25 | 26 |
| 26 using aura::test::WindowIsAbove; | 27 using aura::test::WindowIsAbove; |
| 27 | 28 |
| 28 class PanelLayoutManagerTest : public ash::test::AshTestBase { | 29 class PanelLayoutManagerTest : public ash::test::AshTestBase { |
| 29 public: | 30 public: |
| 30 PanelLayoutManagerTest() {} | 31 PanelLayoutManagerTest() {} |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w1.get())); | 201 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w1.get())); |
| 201 wm::ActivateWindow(w2.get()); | 202 wm::ActivateWindow(w2.get()); |
| 202 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w2.get())); | 203 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w2.get())); |
| 203 wm::ActivateWindow(w3.get()); | 204 wm::ActivateWindow(w3.get()); |
| 204 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w3.get())); | 205 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w3.get())); |
| 205 wm::ActivateWindow(w4.get()); | 206 wm::ActivateWindow(w4.get()); |
| 206 EXPECT_FALSE(IsCalloutVisible()); | 207 EXPECT_FALSE(IsCalloutVisible()); |
| 207 wm::ActivateWindow(w3.get()); | 208 wm::ActivateWindow(w3.get()); |
| 208 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w3.get())); | 209 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w3.get())); |
| 209 w3.reset(); | 210 w3.reset(); |
| 210 EXPECT_FALSE(IsCalloutVisible()); | 211 if (views::corewm::UseFocusController()) |
| 212 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w2.get())); |
| 213 else |
| 214 EXPECT_FALSE(IsCalloutVisible()); |
| 211 } | 215 } |
| 212 | 216 |
| 213 // Tests removing panels. | 217 // Tests removing panels. |
| 214 TEST_F(PanelLayoutManagerTest, RemoveLeftPanel) { | 218 TEST_F(PanelLayoutManagerTest, RemoveLeftPanel) { |
| 215 gfx::Rect bounds(0, 0, 201, 201); | 219 gfx::Rect bounds(0, 0, 201, 201); |
| 216 scoped_ptr<aura::Window> w1(CreatePanelWindow(bounds)); | 220 scoped_ptr<aura::Window> w1(CreatePanelWindow(bounds)); |
| 217 scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds)); | 221 scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds)); |
| 218 scoped_ptr<aura::Window> w3(CreatePanelWindow(bounds)); | 222 scoped_ptr<aura::Window> w3(CreatePanelWindow(bounds)); |
| 219 | 223 |
| 220 // At this point, windows should be stacked with 1 < 2 < 3 | 224 // At this point, windows should be stacked with 1 < 2 < 3 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 RunAllPendingInMessageLoop(); | 319 RunAllPendingInMessageLoop(); |
| 316 EXPECT_FALSE(IsCalloutVisible()); | 320 EXPECT_FALSE(IsCalloutVisible()); |
| 317 // Activate the window, ensure callout is visible. | 321 // Activate the window, ensure callout is visible. |
| 318 wm::ActivateWindow(window.get()); | 322 wm::ActivateWindow(window.get()); |
| 319 RunAllPendingInMessageLoop(); | 323 RunAllPendingInMessageLoop(); |
| 320 EXPECT_TRUE(IsCalloutVisible()); | 324 EXPECT_TRUE(IsCalloutVisible()); |
| 321 } | 325 } |
| 322 | 326 |
| 323 } // namespace internal | 327 } // namespace internal |
| 324 } // namespace ash | 328 } // namespace ash |
| OLD | NEW |