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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 1497 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
1498 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1498 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
1499 views::Widget* widget = new views::Widget; | 1499 views::Widget* widget = new views::Widget; |
1500 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 1500 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
1501 params.bounds = gfx::Rect(0, 0, 200, 200); | 1501 params.bounds = gfx::Rect(0, 0, 200, 200); |
1502 params.context = CurrentContext(); | 1502 params.context = CurrentContext(); |
1503 widget->Init(params); | 1503 widget->Init(params); |
1504 widget->Show(); | 1504 widget->Show(); |
1505 widget->Maximize(); | 1505 widget->Maximize(); |
1506 | 1506 |
| 1507 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 1508 |
1507 aura::Window* window = widget->GetNativeWindow(); | 1509 aura::Window* window = widget->GetNativeWindow(); |
1508 shelf->LayoutShelf(); | 1510 shelf->LayoutShelf(); |
1509 | 1511 |
1510 gfx::Rect shelf_shown = GetShelfWidget()->GetWindowBoundsInScreen(); | 1512 gfx::Rect shelf_shown = GetShelfWidget()->GetWindowBoundsInScreen(); |
1511 gfx::Rect bounds_shelf = window->bounds(); | 1513 gfx::Rect bounds_shelf = window->bounds(); |
| 1514 |
| 1515 // Edge swipe when SHELF_VISIBLE should not change visibility state. |
| 1516 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); |
| 1517 generator.GestureEdgeSwipe(); |
1512 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); | 1518 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); |
1513 | 1519 |
| 1520 // Edge swipe when AUTO_HIDE_HIDDEN should change to AUTO_HIDE_SHOWN. |
1514 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1521 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
1515 shelf->LayoutShelf(); | 1522 shelf->LayoutShelf(); |
| 1523 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1516 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 1524 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
1517 | |
1518 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | |
1519 generator.GestureEdgeSwipe(); | 1525 generator.GestureEdgeSwipe(); |
1520 | 1526 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1521 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); | 1527 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); |
1522 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); | |
1523 | 1528 |
1524 widget->SetFullscreen(true); | 1529 widget->SetFullscreen(true); |
1525 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false); | 1530 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false); |
1526 shelf->UpdateVisibilityState(); | 1531 shelf->UpdateVisibilityState(); |
1527 | 1532 |
1528 gfx::Rect bounds_fullscreen = window->bounds(); | 1533 // Edge swipe in fullscreen + AUTO_HIDE_HIDDEN should show the shelf and |
| 1534 // remain fullscreen. |
1529 EXPECT_TRUE(widget->IsFullscreen()); | 1535 EXPECT_TRUE(widget->IsFullscreen()); |
| 1536 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1530 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 1537 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
1531 | |
1532 generator.GestureEdgeSwipe(); | 1538 generator.GestureEdgeSwipe(); |
1533 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); | 1539 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1534 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); | 1540 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); |
1535 EXPECT_FALSE(widget->IsFullscreen()); | 1541 EXPECT_TRUE(widget->IsFullscreen()); |
1536 } | 1542 } |
1537 | 1543 |
1538 #if defined(OS_WIN) | 1544 #if defined(OS_WIN) |
1539 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 | 1545 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 |
1540 #define MAYBE_GestureDrag DISABLED_GestureDrag | 1546 #define MAYBE_GestureDrag DISABLED_GestureDrag |
1541 #else | 1547 #else |
1542 #define MAYBE_GestureDrag GestureDrag | 1548 #define MAYBE_GestureDrag GestureDrag |
1543 #endif | 1549 #endif |
1544 | 1550 |
1545 TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) { | 1551 TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 1968 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
1963 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1969 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1964 generator.ClickLeftButton(); | 1970 generator.ClickLeftButton(); |
1965 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); | 1971 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); |
1966 generator.ClickLeftButton(); | 1972 generator.ClickLeftButton(); |
1967 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1973 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1968 } | 1974 } |
1969 | 1975 |
1970 } // namespace internal | 1976 } // namespace internal |
1971 } // namespace ash | 1977 } // namespace ash |
OLD | NEW |