| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/shelf/shelf_widget.h" | 5 #include "ash/shelf/shelf_widget.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/launcher/launcher_button.h" | 8 #include "ash/launcher/launcher_button.h" |
| 9 #include "ash/launcher/launcher_model.h" | |
| 10 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| 11 #include "ash/shelf/shelf_model.h" |
| 12 #include "ash/shelf/shelf_view.h" | 12 #include "ash/shelf/shelf_view.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
| 15 #include "ash/test/launcher_test_api.h" | 15 #include "ash/test/launcher_test_api.h" |
| 16 #include "ash/test/shelf_view_test_api.h" | 16 #include "ash/test/shelf_view_test_api.h" |
| 17 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
| 18 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
| 19 #include "ui/gfx/display.h" | 19 #include "ui/gfx/display.h" |
| 20 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
| 21 #include "ui/views/corewm/corewm_switches.h" | 21 #include "ui/views/corewm/corewm_switches.h" |
| 22 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
| 23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 ShelfWidget* GetShelfWidget() { | 29 ShelfWidget* GetShelfWidget() { |
| 30 return Launcher::ForPrimaryDisplay()->shelf_widget(); | 30 return Launcher::ForPrimaryDisplay()->shelf_widget(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 internal::ShelfLayoutManager* GetShelfLayoutManager() { | 33 internal::ShelfLayoutManager* GetShelfLayoutManager() { |
| 34 return GetShelfWidget()->shelf_layout_manager(); | 34 return GetShelfWidget()->shelf_layout_manager(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 typedef test::AshTestBase ShelfWidgetTest; | 39 typedef test::AshTestBase ShelfWidgetTest; |
| 40 | 40 |
| 41 // Launcher can't be activated on mouse click, but it is activable from | 41 // Shelf can't be activated on mouse click, but it is activable from |
| 42 // the focus cycler or as fallback. | 42 // the focus cycler or as fallback. |
| 43 // TODO(mtomasz): make this test work with the FocusController. | 43 // TODO(mtomasz): make this test work with the FocusController. |
| 44 // crbug.com/285364. | 44 // crbug.com/285364. |
| 45 TEST_F(ShelfWidgetTest, DISABLED_ActivateAsFallback) { | 45 TEST_F(ShelfWidgetTest, DISABLED_ActivateAsFallback) { |
| 46 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 46 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
| 47 ShelfWidget* shelf_widget = launcher->shelf_widget(); | 47 ShelfWidget* shelf_widget = launcher->shelf_widget(); |
| 48 EXPECT_FALSE(shelf_widget->CanActivate()); | 48 EXPECT_FALSE(shelf_widget->CanActivate()); |
| 49 | 49 |
| 50 shelf_widget->WillActivateAsFallback(); | 50 shelf_widget->WillActivateAsFallback(); |
| 51 EXPECT_TRUE(shelf_widget->CanActivate()); | 51 EXPECT_TRUE(shelf_widget->CanActivate()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 const int status_width = | 185 const int status_width = |
| 186 shelf->status_area_widget()->GetWindowBoundsInScreen().width(); | 186 shelf->status_area_widget()->GetWindowBoundsInScreen().width(); |
| 187 EXPECT_GT(status_width, 0); | 187 EXPECT_GT(status_width, 0); |
| 188 EXPECT_EQ(status_width, | 188 EXPECT_EQ(status_width, |
| 189 shelf->GetContentsView()->width() - | 189 shelf->GetContentsView()->width() - |
| 190 test::LauncherTestAPI(launcher).shelf_view()->width()); | 190 test::LauncherTestAPI(launcher).shelf_view()->width()); |
| 191 } | 191 } |
| 192 #endif | 192 #endif |
| 193 | 193 |
| 194 } // namespace ash | 194 } // namespace ash |
| OLD | NEW |