| 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/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #else | 44 #else |
| 45 #define MAYBE_SetVisible SetVisible | 45 #define MAYBE_SetVisible SetVisible |
| 46 #endif | 46 #endif |
| 47 // Makes sure SetVisible updates work area and widget appropriately. | 47 // Makes sure SetVisible updates work area and widget appropriately. |
| 48 TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { | 48 TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { |
| 49 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 49 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 50 // Force an initial layout. | 50 // Force an initial layout. |
| 51 shelf->LayoutShelf(); | 51 shelf->LayoutShelf(); |
| 52 ASSERT_TRUE(shelf->visible()); | 52 ASSERT_TRUE(shelf->visible()); |
| 53 | 53 |
| 54 aura::ScreenAura* screen = Shell::GetRootWindow()->screen(); | 54 const aura::ScreenAura* screen = Shell::GetRootWindow()->screen(); |
| 55 ASSERT_TRUE(screen); | 55 ASSERT_TRUE(screen); |
| 56 // Bottom inset should be the max of widget heights. | 56 // Bottom inset should be the max of widget heights. |
| 57 EXPECT_EQ(shelf->max_height(), screen->work_area_insets().bottom()); | 57 EXPECT_EQ(shelf->max_height(), screen->work_area_insets().bottom()); |
| 58 | 58 |
| 59 // Hide the shelf. | 59 // Hide the shelf. |
| 60 shelf->SetVisible(false); | 60 shelf->SetVisible(false); |
| 61 // Run the animation to completion. | 61 // Run the animation to completion. |
| 62 StepWidgetLayerAnimatorToEnd(shelf->launcher()); | 62 StepWidgetLayerAnimatorToEnd(shelf->launcher()); |
| 63 StepWidgetLayerAnimatorToEnd(shelf->status()); | 63 StepWidgetLayerAnimatorToEnd(shelf->status()); |
| 64 EXPECT_FALSE(shelf->visible()); | 64 EXPECT_FALSE(shelf->visible()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 89 bottom + (shelf->max_height() - status_bounds.height()) / 2); | 89 bottom + (shelf->max_height() - status_bounds.height()) / 2); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Makes sure LayoutShelf invoked while animating cleans things up. | 92 // Makes sure LayoutShelf invoked while animating cleans things up. |
| 93 TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { | 93 TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { |
| 94 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 94 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 95 // Force an initial layout. | 95 // Force an initial layout. |
| 96 shelf->LayoutShelf(); | 96 shelf->LayoutShelf(); |
| 97 ASSERT_TRUE(shelf->visible()); | 97 ASSERT_TRUE(shelf->visible()); |
| 98 | 98 |
| 99 aura::ScreenAura* screen = Shell::GetRootWindow()->screen(); | 99 const aura::ScreenAura* screen = Shell::GetRootWindow()->screen(); |
| 100 | 100 |
| 101 // Hide the shelf. | 101 // Hide the shelf. |
| 102 shelf->SetVisible(false); | 102 shelf->SetVisible(false); |
| 103 shelf->LayoutShelf(); | 103 shelf->LayoutShelf(); |
| 104 EXPECT_FALSE(shelf->visible()); | 104 EXPECT_FALSE(shelf->visible()); |
| 105 EXPECT_FALSE(shelf->visible()); | 105 EXPECT_FALSE(shelf->visible()); |
| 106 EXPECT_EQ(0, screen->work_area_insets().bottom()); | 106 EXPECT_EQ(0, screen->work_area_insets().bottom()); |
| 107 // Make sure the bounds of the two widgets changed. | 107 // Make sure the bounds of the two widgets changed. |
| 108 EXPECT_GE(shelf->launcher()->GetNativeView()->bounds().y(), | 108 EXPECT_GE(shelf->launcher()->GetNativeView()->bounds().y(), |
| 109 gfx::Screen::GetPrimaryMonitorBounds().bottom()); | 109 gfx::Screen::GetPrimaryMonitorBounds().bottom()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 views::Widget* widget = new views::Widget; | 142 views::Widget* widget = new views::Widget; |
| 143 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 143 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 144 params.bounds = gfx::Rect(0, 0, 200, 200); | 144 params.bounds = gfx::Rect(0, 0, 200, 200); |
| 145 // Widget is now owned by the parent window. | 145 // Widget is now owned by the parent window. |
| 146 widget->Init(params); | 146 widget->Init(params); |
| 147 widget->SetFullscreen(true); | 147 widget->SetFullscreen(true); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace internal | 150 } // namespace internal |
| 151 } // namespace ash | 151 } // namespace ash |
| OLD | NEW |