Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: ash/shelf/shelf_layout_manager_unittest.cc

Issue 2583393002: Send notification to users upon receiving sms messages (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/shelf/shelf_layout_manager.h" 5 #include "ash/common/shelf/shelf_layout_manager.h"
6 6
7 #include "ash/common/accelerators/accelerator_controller.h" 7 #include "ash/common/accelerators/accelerator_controller.h"
8 #include "ash/common/accelerators/accelerator_table.h" 8 #include "ash/common/accelerators/accelerator_table.h"
9 #include "ash/common/focus_cycler.h" 9 #include "ash/common/focus_cycler.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 StatusAreaWidget* status_area_widget = 1517 StatusAreaWidget* status_area_widget =
1518 shelf->shelf_widget()->status_area_widget(); 1518 shelf->shelf_widget()->status_area_widget();
1519 SystemTray* tray = GetPrimarySystemTray(); 1519 SystemTray* tray = GetPrimarySystemTray();
1520 1520
1521 // Create a visible window so auto-hide behavior is enforced. 1521 // Create a visible window so auto-hide behavior is enforced.
1522 CreateTestWidget(); 1522 CreateTestWidget();
1523 1523
1524 layout_manager->LayoutShelf(); 1524 layout_manager->LayoutShelf();
1525 ui::test::EventGenerator& generator(GetEventGenerator()); 1525 ui::test::EventGenerator& generator(GetEventGenerator());
1526 1526
1527 // Make two iterations - first without a message bubble which should make 1527 // Make sure the shelf is visible and position the mouse over it. Then
1528 // the shelf disappear and then with a message bubble which should keep it 1528 // allow auto hide.
1529 // visible. 1529 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1530 for (int i = 0; i < 2; i++) { 1530 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1531 // Make sure the shelf is visible and position the mouse over it. Then 1531 gfx::Point center =
1532 // allow auto hide. 1532 status_area_widget->GetWindowBoundsInScreen().CenterPoint();
1533 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 1533 generator.MoveMouseTo(center.x(), center.y());
1534 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1534 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1535 gfx::Point center = 1535 EXPECT_TRUE(layout_manager->IsVisible());
1536 status_area_widget->GetWindowBoundsInScreen().CenterPoint(); 1536 // Make sure there is no bubble.
1537 generator.MoveMouseTo(center.x(), center.y()); 1537 tray->CloseSystemBubble();
1538 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 1538 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1539 EXPECT_TRUE(layout_manager->IsVisible()); 1539 // Move the pointer over the edge of the shelf.
1540 if (!i) { 1540 generator.MoveMouseTo(center.x(),
1541 // In our first iteration we make sure there is no bubble. 1541 status_area_widget->GetWindowBoundsInScreen().y() - 8);
1542 tray->CloseSystemBubble(); 1542 layout_manager->UpdateVisibilityState();
1543 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1543 EXPECT_FALSE(layout_manager->IsVisible());
1544 } else { 1544 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1545 // In our second iteration we show a bubble.
1546 test::TestSystemTrayItem* item = new test::TestSystemTrayItem();
1547 tray->AddTrayItem(base::WrapUnique(item));
1548 tray->ShowNotificationView(item);
1549 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
1550 }
1551 // Move the pointer over the edge of the shelf.
1552 generator.MoveMouseTo(
1553 center.x(), status_area_widget->GetWindowBoundsInScreen().y() - 8);
1554 layout_manager->UpdateVisibilityState();
1555 if (i) {
1556 EXPECT_TRUE(layout_manager->IsVisible());
1557 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
1558 } else {
1559 EXPECT_FALSE(layout_manager->IsVisible());
1560 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1561 }
1562 }
1563 } 1545 }
1564 1546
1565 TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColor) { 1547 TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColor) {
1566 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); 1548 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());
1567 1549
1568 std::unique_ptr<aura::Window> w1(CreateTestWindow()); 1550 std::unique_ptr<aura::Window> w1(CreateTestWindow());
1569 w1->Show(); 1551 w1->Show();
1570 wm::ActivateWindow(w1.get()); 1552 wm::ActivateWindow(w1.get());
1571 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); 1553 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());
1572 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1554 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 // Open keyboard in sticky mode. 1782 // Open keyboard in sticky mode.
1801 kb_controller->ShowKeyboard(true); 1783 kb_controller->ShowKeyboard(true);
1802 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); 1784 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds());
1803 1785
1804 // Work area should be changed. 1786 // Work area should be changed.
1805 EXPECT_NE(orig_work_area, 1787 EXPECT_NE(orig_work_area,
1806 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1788 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1807 } 1789 }
1808 1790
1809 } // namespace ash 1791 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698