| 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" |
| 11 #include "ash/common/accessibility_delegate.h" | 11 #include "ash/common/accessibility_delegate.h" |
| 12 #include "ash/common/shelf/wm_shelf.h" | 12 #include "ash/common/shelf/wm_shelf.h" |
| 13 #include "ash/common/system/status_area_widget.h" | 13 #include "ash/common/system/status_area_widget.h" |
| 14 #include "ash/common/system/tray/system_tray_bubble.h" | 14 #include "ash/common/system/tray/system_tray_bubble.h" |
| 15 #include "ash/common/system/tray/system_tray_item.h" | 15 #include "ash/common/system/tray/system_tray_item.h" |
| 16 #include "ash/common/system/tray/tray_constants.h" | 16 #include "ash/common/system/tray/tray_constants.h" |
| 17 #include "ash/common/system/tray/tray_popup_item_container.h" | 17 #include "ash/common/system/tray/tray_popup_item_container.h" |
| 18 #include "ash/common/system/web_notification/web_notification_tray.h" | 18 #include "ash/common/system/web_notification/web_notification_tray.h" |
| 19 #include "ash/common/wm_shell.h" | 19 #include "ash/common/wm_shell.h" |
| 20 #include "ash/common/wm_window.h" | 20 #include "ash/common/wm_window.h" |
| 21 #include "ash/public/cpp/shell_window_ids.h" | 21 #include "ash/public/cpp/shell_window_ids.h" |
| 22 #include "ash/root_window_controller.h" | 22 #include "ash/root_window_controller.h" |
| 23 #include "ash/shell.h" |
| 23 #include "ash/test/ash_test_base.h" | 24 #include "ash/test/ash_test_base.h" |
| 24 #include "ash/test/status_area_widget_test_helper.h" | 25 #include "ash/test/status_area_widget_test_helper.h" |
| 25 #include "ash/test/test_system_tray_item.h" | 26 #include "ash/test/test_system_tray_item.h" |
| 26 #include "base/memory/ptr_util.h" | 27 #include "base/memory/ptr_util.h" |
| 27 #include "base/run_loop.h" | 28 #include "base/run_loop.h" |
| 28 #include "base/test/histogram_tester.h" | 29 #include "base/test/histogram_tester.h" |
| 29 #include "ui/base/ui_base_types.h" | 30 #include "ui/base/ui_base_types.h" |
| 30 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 31 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 31 #include "ui/events/test/event_generator.h" | 32 #include "ui/events/test/event_generator.h" |
| 32 #include "ui/gfx/geometry/point.h" | 33 #include "ui/gfx/geometry/point.h" |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 EXPECT_TRUE(tray->HasSystemBubble()); | 478 EXPECT_TRUE(tray->HasSystemBubble()); |
| 478 | 479 |
| 479 ui::test::EventGenerator& generator = GetEventGenerator(); | 480 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 480 generator.set_current_location(gfx::Point(5, 5)); | 481 generator.set_current_location(gfx::Point(5, 5)); |
| 481 generator.ClickLeftButton(); | 482 generator.ClickLeftButton(); |
| 482 EXPECT_TRUE(tray->HasSystemBubble()); | 483 EXPECT_TRUE(tray->HasSystemBubble()); |
| 483 } | 484 } |
| 484 | 485 |
| 485 TEST_F(SystemTrayTest, WithSystemModal) { | 486 TEST_F(SystemTrayTest, WithSystemModal) { |
| 486 // Check if the accessibility item is created even with system modal dialog. | 487 // Check if the accessibility item is created even with system modal dialog. |
| 487 WmShell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(true); | 488 Shell::GetInstance()->accessibility_delegate()->SetVirtualKeyboardEnabled( |
| 489 true); |
| 488 std::unique_ptr<views::Widget> widget(CreateTestWidget( | 490 std::unique_ptr<views::Widget> widget(CreateTestWidget( |
| 489 new ModalWidgetDelegate, kShellWindowId_SystemModalContainer, | 491 new ModalWidgetDelegate, kShellWindowId_SystemModalContainer, |
| 490 gfx::Rect(0, 0, 100, 100))); | 492 gfx::Rect(0, 0, 100, 100))); |
| 491 | 493 |
| 492 SystemTray* tray = GetPrimarySystemTray(); | 494 SystemTray* tray = GetPrimarySystemTray(); |
| 493 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 495 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 494 | 496 |
| 495 ASSERT_TRUE(tray->HasSystemBubble()); | 497 ASSERT_TRUE(tray->HasSystemBubble()); |
| 496 const views::View* accessibility = | 498 const views::View* accessibility = |
| 497 tray->GetSystemBubble()->bubble_view()->GetViewByID( | 499 tray->GetSystemBubble()->bubble_view()->GetViewByID( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 555 |
| 554 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); | 556 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); |
| 555 } | 557 } |
| 556 | 558 |
| 557 TEST_F(SystemTrayTest, SeparatorThickness) { | 559 TEST_F(SystemTrayTest, SeparatorThickness) { |
| 558 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); | 560 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); |
| 559 } | 561 } |
| 560 | 562 |
| 561 } // namespace test | 563 } // namespace test |
| 562 } // namespace ash | 564 } // namespace ash |
| OLD | NEW |