| 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/common/system/tray/system_tray.h" | 5 #include "ash/common/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/accelerators/accelerator_controller.h" | 10 #include "ash/common/accelerators/accelerator_controller.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 // Ensure that closing the bubble destroys it. | 198 // Ensure that closing the bubble destroys it. |
| 199 ASSERT_TRUE(tray->CloseSystemBubble()); | 199 ASSERT_TRUE(tray->CloseSystemBubble()); |
| 200 RunAllPendingInMessageLoop(); | 200 RunAllPendingInMessageLoop(); |
| 201 ASSERT_FALSE(tray->CloseSystemBubble()); | 201 ASSERT_FALSE(tray->CloseSystemBubble()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 // Make sure the opening system tray bubble will not deactivate the | 204 // Make sure the opening system tray bubble will not deactivate the |
| 205 // other window. crbug.com/120680. | 205 // other window. crbug.com/120680. |
| 206 TEST_F(SystemTrayTest, Activation) { | 206 TEST_F(SystemTrayTest, Activation) { |
| 207 // TODO: investigate why this fails in mash. http://crbug.com/695559. |
| 208 if (WmShell::Get()->IsRunningInMash()) |
| 209 return; |
| 210 |
| 207 SystemTray* tray = GetPrimarySystemTray(); | 211 SystemTray* tray = GetPrimarySystemTray(); |
| 208 std::unique_ptr<views::Widget> widget(CreateTestWidget( | 212 std::unique_ptr<views::Widget> widget(CreateTestWidget( |
| 209 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 100, 100))); | 213 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 100, 100))); |
| 210 EXPECT_TRUE(widget->IsActive()); | 214 EXPECT_TRUE(widget->IsActive()); |
| 211 | 215 |
| 212 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 216 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 213 ASSERT_TRUE(tray->GetWidget()); | 217 ASSERT_TRUE(tray->GetWidget()); |
| 214 EXPECT_FALSE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive()); | 218 EXPECT_FALSE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive()); |
| 215 EXPECT_TRUE(widget->IsActive()); | 219 EXPECT_TRUE(widget->IsActive()); |
| 216 | 220 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 453 |
| 450 // Test in the right alignment. | 454 // Test in the right alignment. |
| 451 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 455 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 452 window_bounds = widget->GetWindowBoundsInScreen(); | 456 window_bounds = widget->GetWindowBoundsInScreen(); |
| 453 tray_bounds = tray->GetBoundsInScreen(); | 457 tray_bounds = tray->GetBoundsInScreen(); |
| 454 // TODO(estade): Re-enable this check. See crbug.com/660928. | 458 // TODO(estade): Re-enable this check. See crbug.com/660928. |
| 455 // EXPECT_TRUE(window_bounds.Contains(tray_bounds)); | 459 // EXPECT_TRUE(window_bounds.Contains(tray_bounds)); |
| 456 } | 460 } |
| 457 | 461 |
| 458 TEST_F(SystemTrayTest, PersistentBubble) { | 462 TEST_F(SystemTrayTest, PersistentBubble) { |
| 463 // TODO: investigate why this fails in mash. http://crbug.com/695559. |
| 464 if (WmShell::Get()->IsRunningInMash()) |
| 465 return; |
| 466 |
| 459 SystemTray* tray = GetPrimarySystemTray(); | 467 SystemTray* tray = GetPrimarySystemTray(); |
| 460 ASSERT_TRUE(tray->GetWidget()); | 468 ASSERT_TRUE(tray->GetWidget()); |
| 461 | 469 |
| 462 TestSystemTrayItem* test_item = new TestSystemTrayItem(); | 470 TestSystemTrayItem* test_item = new TestSystemTrayItem(); |
| 463 tray->AddTrayItem(base::WrapUnique(test_item)); | 471 tray->AddTrayItem(base::WrapUnique(test_item)); |
| 464 | 472 |
| 465 std::unique_ptr<views::Widget> widget(CreateTestWidget( | 473 std::unique_ptr<views::Widget> widget(CreateTestWidget( |
| 466 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 100, 100))); | 474 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 100, 100))); |
| 467 | 475 |
| 468 // Tests for usual default view while activating a window. | 476 // Tests for usual default view while activating a window. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 588 |
| 581 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); | 589 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); |
| 582 } | 590 } |
| 583 | 591 |
| 584 TEST_F(SystemTrayTest, SeparatorThickness) { | 592 TEST_F(SystemTrayTest, SeparatorThickness) { |
| 585 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); | 593 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); |
| 586 } | 594 } |
| 587 | 595 |
| 588 } // namespace test | 596 } // namespace test |
| 589 } // namespace ash | 597 } // namespace ash |
| OLD | NEW |