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/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_button.h" | 9 #include "ash/shelf/shelf_button.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 internal::ShelfLayoutManager* GetShelfLayoutManager() { | 34 internal::ShelfLayoutManager* GetShelfLayoutManager() { |
35 return GetShelfWidget()->shelf_layout_manager(); | 35 return GetShelfWidget()->shelf_layout_manager(); |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 typedef test::AshTestBase ShelfWidgetTest; | 40 typedef test::AshTestBase ShelfWidgetTest; |
41 | 41 |
42 // Shelf can't be activated on mouse click, but it is activable from | |
43 // the focus cycler or as fallback. | |
44 // TODO(mtomasz): make this test work with the FocusController. | |
45 // crbug.com/285364. | |
46 TEST_F(ShelfWidgetTest, DISABLED_ActivateAsFallback) { | |
47 Shelf* shelf = Shelf::ForPrimaryDisplay(); | |
48 ShelfWidget* shelf_widget = shelf->shelf_widget(); | |
49 EXPECT_FALSE(shelf_widget->CanActivate()); | |
50 | |
51 shelf_widget->WillActivateAsFallback(); | |
52 EXPECT_TRUE(shelf_widget->CanActivate()); | |
53 | |
54 wm::ActivateWindow(shelf_widget->GetNativeWindow()); | |
55 EXPECT_FALSE(shelf_widget->CanActivate()); | |
56 } | |
57 | |
58 void TestLauncherAlignment(aura::Window* root, | 42 void TestLauncherAlignment(aura::Window* root, |
59 ShelfAlignment alignment, | 43 ShelfAlignment alignment, |
60 const std::string& expected) { | 44 const std::string& expected) { |
61 Shell::GetInstance()->SetShelfAlignment(alignment, root); | 45 Shell::GetInstance()->SetShelfAlignment(alignment, root); |
62 gfx::Screen* screen = gfx::Screen::GetScreenFor(root); | 46 gfx::Screen* screen = gfx::Screen::GetScreenFor(root); |
63 EXPECT_EQ(expected, | 47 EXPECT_EQ(expected, |
64 screen->GetDisplayNearestWindow(root).work_area().ToString()); | 48 screen->GetDisplayNearestWindow(root).work_area().ToString()); |
65 } | 49 } |
66 | 50 |
67 TEST_F(ShelfWidgetTest, TestAlignment) { | 51 TEST_F(ShelfWidgetTest, TestAlignment) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 { | 284 { |
301 gfx::Point event_location(20, shelf_bounds.y() - 1); | 285 gfx::Point event_location(20, shelf_bounds.y() - 1); |
302 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, event_location, 0, | 286 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, event_location, 0, |
303 ui::EventTimeForNow()); | 287 ui::EventTimeForNow()); |
304 EXPECT_EQ(shelf_widget->GetNativeWindow(), | 288 EXPECT_EQ(shelf_widget->GetNativeWindow(), |
305 targeter->FindTargetForEvent(root, &touch)); | 289 targeter->FindTargetForEvent(root, &touch)); |
306 } | 290 } |
307 } | 291 } |
308 | 292 |
309 } // namespace ash | 293 } // namespace ash |
OLD | NEW |