OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ash/common/system/chromeos/media_security/multi_profile_media_tray_ite
m.h" | |
6 | |
7 #include "ash/common/ash_view_ids.h" | |
8 #include "ash/common/system/status_area_widget.h" | |
9 #include "ash/common/system/tray/system_tray.h" | |
10 #include "ash/common/system/tray/system_tray_bubble.h" | |
11 #include "ash/common/system/tray/tray_item_view.h" | |
12 #include "ash/test/ash_test_base.h" | |
13 #include "ash/test/ash_test_helper.h" | |
14 #include "ash/test/status_area_widget_test_helper.h" | |
15 #include "ash/test/test_session_state_delegate.h" | |
16 #include "ash/test/test_shell_delegate.h" | |
17 #include "ui/views/bubble/tray_bubble_view.h" | |
18 | |
19 namespace ash { | |
20 | |
21 using MultiProfileMediaTrayItemTest = test::AshTestBase; | |
22 | |
23 TEST_F(MultiProfileMediaTrayItemTest, NotifyMediaCaptureChange) { | |
24 TrayItemView::DisableAnimationsForTest(); | |
25 test::TestShellDelegate* shell_delegate = | |
26 ash_test_helper()->test_shell_delegate(); | |
27 test::TestSessionStateDelegate* session_state_delegate = | |
28 test::AshTestHelper::GetTestSessionStateDelegate(); | |
29 session_state_delegate->set_logged_in_users(2); | |
30 | |
31 SystemTray* system_tray = GetPrimarySystemTray(); | |
32 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW); | |
33 views::View* in_user_view = | |
34 system_tray->GetSystemBubble()->bubble_view()->GetViewByID( | |
35 VIEW_ID_USER_VIEW_MEDIA_INDICATOR); | |
36 | |
37 StatusAreaWidget* widget = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); | |
38 EXPECT_TRUE(widget->GetRootView()->visible()); | |
39 views::View* tray_view = | |
40 widget->GetRootView()->GetViewByID(VIEW_ID_MEDIA_TRAY_VIEW); | |
41 | |
42 EXPECT_FALSE(tray_view->visible()); | |
43 EXPECT_FALSE(in_user_view->visible()); | |
44 | |
45 shell_delegate->SetMediaCaptureState(MEDIA_CAPTURE_AUDIO); | |
46 EXPECT_TRUE(tray_view->visible()); | |
47 EXPECT_TRUE(in_user_view->visible()); | |
48 | |
49 shell_delegate->SetMediaCaptureState(MEDIA_CAPTURE_AUDIO_VIDEO); | |
50 EXPECT_TRUE(tray_view->visible()); | |
51 EXPECT_TRUE(in_user_view->visible()); | |
52 | |
53 shell_delegate->SetMediaCaptureState(MEDIA_CAPTURE_NONE); | |
54 EXPECT_FALSE(tray_view->visible()); | |
55 EXPECT_FALSE(in_user_view->visible()); | |
56 } | |
57 | |
58 } // namespace ash | |
OLD | NEW |