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/web_notification/web_notification_tray.h" | 17 #include "ash/common/system/web_notification/web_notification_tray.h" |
18 #include "ash/common/wm_shell.h" | |
19 #include "ash/common/wm_window.h" | 18 #include "ash/common/wm_window.h" |
20 #include "ash/public/cpp/shell_window_ids.h" | 19 #include "ash/public/cpp/shell_window_ids.h" |
21 #include "ash/root_window_controller.h" | 20 #include "ash/root_window_controller.h" |
22 #include "ash/shell.h" | 21 #include "ash/shell.h" |
23 #include "ash/test/ash_test_base.h" | 22 #include "ash/test/ash_test_base.h" |
24 #include "ash/test/status_area_widget_test_helper.h" | 23 #include "ash/test/status_area_widget_test_helper.h" |
25 #include "ash/test/test_system_tray_item.h" | 24 #include "ash/test/test_system_tray_item.h" |
26 #include "base/memory/ptr_util.h" | 25 #include "base/memory/ptr_util.h" |
27 #include "base/run_loop.h" | 26 #include "base/run_loop.h" |
28 #include "base/test/histogram_tester.h" | 27 #include "base/test/histogram_tester.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 tray->ActivateBubble(); | 218 tray->ActivateBubble(); |
220 EXPECT_TRUE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive()); | 219 EXPECT_TRUE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive()); |
221 EXPECT_FALSE(widget->IsActive()); | 220 EXPECT_FALSE(widget->IsActive()); |
222 | 221 |
223 // Closing the bubble re-activates the window. | 222 // Closing the bubble re-activates the window. |
224 tray->CloseSystemBubble(); | 223 tray->CloseSystemBubble(); |
225 EXPECT_TRUE(widget->IsActive()); | 224 EXPECT_TRUE(widget->IsActive()); |
226 | 225 |
227 // Opening the bubble with an accelerator activates the bubble because the | 226 // Opening the bubble with an accelerator activates the bubble because the |
228 // user will probably navigate with the keyboard. | 227 // user will probably navigate with the keyboard. |
229 WmShell::Get()->accelerator_controller()->PerformActionIfEnabled( | 228 Shell::Get()->accelerator_controller()->PerformActionIfEnabled( |
230 SHOW_SYSTEM_TRAY_BUBBLE); | 229 SHOW_SYSTEM_TRAY_BUBBLE); |
231 ASSERT_TRUE(tray->GetWidget()); | 230 ASSERT_TRUE(tray->GetWidget()); |
232 EXPECT_TRUE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive()); | 231 EXPECT_TRUE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive()); |
233 EXPECT_FALSE(widget->IsActive()); | 232 EXPECT_FALSE(widget->IsActive()); |
234 } | 233 } |
235 | 234 |
236 // Opening and closing the bubble should change the coloring of the tray. | 235 // Opening and closing the bubble should change the coloring of the tray. |
237 TEST_F(SystemTrayTest, SystemTrayColoring) { | 236 TEST_F(SystemTrayTest, SystemTrayColoring) { |
238 SystemTray* tray = GetPrimarySystemTray(); | 237 SystemTray* tray = GetPrimarySystemTray(); |
239 ASSERT_TRUE(tray->GetWidget()); | 238 ASSERT_TRUE(tray->GetWidget()); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 | 551 |
553 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); | 552 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); |
554 } | 553 } |
555 | 554 |
556 TEST_F(SystemTrayTest, SeparatorThickness) { | 555 TEST_F(SystemTrayTest, SeparatorThickness) { |
557 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); | 556 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); |
558 } | 557 } |
559 | 558 |
560 } // namespace test | 559 } // namespace test |
561 } // namespace ash | 560 } // namespace ash |
OLD | NEW |