| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 // Test in the right alignment. | 421 // Test in the right alignment. |
| 422 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 422 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 423 window_bounds = widget->GetWindowBoundsInScreen(); | 423 window_bounds = widget->GetWindowBoundsInScreen(); |
| 424 tray_bounds = tray->GetBoundsInScreen(); | 424 tray_bounds = tray->GetBoundsInScreen(); |
| 425 // TODO(estade): Re-enable this check. See crbug.com/660928. | 425 // TODO(estade): Re-enable this check. See crbug.com/660928. |
| 426 // EXPECT_TRUE(window_bounds.Contains(tray_bounds)); | 426 // EXPECT_TRUE(window_bounds.Contains(tray_bounds)); |
| 427 } | 427 } |
| 428 | 428 |
| 429 TEST_F(SystemTrayTest, PersistentBubble) { | 429 TEST_F(SystemTrayTest, PersistentBubble) { |
| 430 // TODO: investigate why this fails in mash. http://crbug.com/695559. | |
| 431 if (WmShell::Get()->IsRunningInMash()) | |
| 432 return; | |
| 433 | |
| 434 SystemTray* tray = GetPrimarySystemTray(); | 430 SystemTray* tray = GetPrimarySystemTray(); |
| 435 ASSERT_TRUE(tray->GetWidget()); | 431 ASSERT_TRUE(tray->GetWidget()); |
| 436 | 432 |
| 437 TestSystemTrayItem* test_item = new TestSystemTrayItem(); | 433 TestSystemTrayItem* test_item = new TestSystemTrayItem(); |
| 438 tray->AddTrayItem(base::WrapUnique(test_item)); | 434 tray->AddTrayItem(base::WrapUnique(test_item)); |
| 439 | 435 |
| 440 std::unique_ptr<views::Widget> widget(CreateTestWidget( | 436 std::unique_ptr<views::Widget> widget(CreateTestWidget( |
| 441 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 100, 100))); | 437 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 100, 100))); |
| 442 | 438 |
| 443 // Tests for usual default view while activating a window. | 439 // Tests for usual default view while activating a window. |
| 444 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 440 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 445 tray->ActivateBubble(); | 441 tray->ActivateBubble(); |
| 446 ASSERT_TRUE(tray->HasSystemBubble()); | 442 ASSERT_TRUE(tray->HasSystemBubble()); |
| 447 widget->Activate(); | 443 widget->Activate(); |
| 448 base::RunLoop().RunUntilIdle(); | 444 base::RunLoop().RunUntilIdle(); |
| 449 ASSERT_FALSE(tray->HasSystemBubble()); | 445 ASSERT_FALSE(tray->HasSystemBubble()); |
| 450 | 446 |
| 447 // Clicking outside the bubble should close it. |
| 451 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 448 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 452 ASSERT_TRUE(tray->HasSystemBubble()); | 449 ASSERT_TRUE(tray->HasSystemBubble()); |
| 453 { | 450 { |
| 454 ui::test::EventGenerator& generator = GetEventGenerator(); | 451 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 455 generator.set_current_location(gfx::Point(5, 5)); | 452 generator.set_current_location(gfx::Point(5, 5)); |
| 456 generator.ClickLeftButton(); | 453 generator.ClickLeftButton(); |
| 457 ASSERT_FALSE(tray->HasSystemBubble()); | 454 ASSERT_FALSE(tray->HasSystemBubble()); |
| 458 } | 455 } |
| 459 | 456 |
| 460 // Same tests for persistent default view. | 457 // Same tests for persistent default view. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 553 |
| 557 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); | 554 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); |
| 558 } | 555 } |
| 559 | 556 |
| 560 TEST_F(SystemTrayTest, SeparatorThickness) { | 557 TEST_F(SystemTrayTest, SeparatorThickness) { |
| 561 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); | 558 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); |
| 562 } | 559 } |
| 563 | 560 |
| 564 } // namespace test | 561 } // namespace test |
| 565 } // namespace ash | 562 } // namespace ash |
| OLD | NEW |