Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: ash/system/tray/media_security/multi_profile_media_tray_item_unittest.cc

Issue 2091933002: mash: Convert TrayBackgroundView to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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/system/tray/media_security/multi_profile_media_tray_item.h" 5 #include "ash/system/tray/media_security/multi_profile_media_tray_item.h"
6 6
7 #include "ash/ash_view_ids.h" 7 #include "ash/ash_view_ids.h"
8 #include "ash/common/system/tray/system_tray_bubble.h"
8 #include "ash/common/system/tray/tray_item_view.h" 9 #include "ash/common/system/tray/tray_item_view.h"
9 #include "ash/shell.h"
10 #include "ash/system/status_area_widget.h" 10 #include "ash/system/status_area_widget.h"
11 #include "ash/system/tray/system_tray.h" 11 #include "ash/system/tray/system_tray.h"
12 #include "ash/system/tray/system_tray_bubble.h"
13 #include "ash/test/ash_test_base.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"
14 #include "ash/test/test_session_state_delegate.h" 15 #include "ash/test/test_session_state_delegate.h"
15 #include "ash/test/test_shell_delegate.h" 16 #include "ash/test/test_shell_delegate.h"
16 #include "ui/views/bubble/tray_bubble_view.h" 17 #include "ui/views/bubble/tray_bubble_view.h"
17 18
18 namespace ash { 19 namespace ash {
19 20
20 typedef test::AshTestBase MultiProfileMediaTrayItemTest; 21 typedef test::AshTestBase MultiProfileMediaTrayItemTest;
21 22
22 TEST_F(MultiProfileMediaTrayItemTest, NotifyMediaCaptureChange) { 23 TEST_F(MultiProfileMediaTrayItemTest, NotifyMediaCaptureChange) {
23 TrayItemView::DisableAnimationsForTest(); 24 TrayItemView::DisableAnimationsForTest();
24 test::TestShellDelegate* shell_delegate = 25 test::TestShellDelegate* shell_delegate =
25 static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate()); 26 ash_test_helper()->test_shell_delegate();
26 test::TestSessionStateDelegate* session_state_delegate = 27 test::TestSessionStateDelegate* session_state_delegate =
27 static_cast<test::TestSessionStateDelegate*>( 28 test::AshTestHelper::GetTestSessionStateDelegate();
28 Shell::GetInstance()->session_state_delegate());
29 session_state_delegate->set_logged_in_users(2); 29 session_state_delegate->set_logged_in_users(2);
30 30
31 SystemTray* system_tray = Shell::GetInstance()->GetPrimarySystemTray(); 31 SystemTray* system_tray = GetPrimarySystemTray();
32 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW); 32 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW);
33 views::View* in_user_view = 33 views::View* in_user_view =
34 system_tray->GetSystemBubble()->bubble_view()->GetViewByID( 34 system_tray->GetSystemBubble()->bubble_view()->GetViewByID(
35 VIEW_ID_USER_VIEW_MEDIA_INDICATOR); 35 VIEW_ID_USER_VIEW_MEDIA_INDICATOR);
36 36
37 StatusAreaWidget* widget = system_tray->status_area_widget(); 37 StatusAreaWidget* widget = StatusAreaWidgetTestHelper::GetStatusAreaWidget();
38 EXPECT_TRUE(widget->GetRootView()->visible()); 38 EXPECT_TRUE(widget->GetRootView()->visible());
39 views::View* tray_view = 39 views::View* tray_view =
40 widget->GetRootView()->GetViewByID(VIEW_ID_MEDIA_TRAY_VIEW); 40 widget->GetRootView()->GetViewByID(VIEW_ID_MEDIA_TRAY_VIEW);
41 41
42 EXPECT_FALSE(tray_view->visible()); 42 EXPECT_FALSE(tray_view->visible());
43 EXPECT_FALSE(in_user_view->visible()); 43 EXPECT_FALSE(in_user_view->visible());
44 44
45 shell_delegate->SetMediaCaptureState(MEDIA_CAPTURE_AUDIO); 45 shell_delegate->SetMediaCaptureState(MEDIA_CAPTURE_AUDIO);
46 EXPECT_TRUE(tray_view->visible()); 46 EXPECT_TRUE(tray_view->visible());
47 EXPECT_TRUE(in_user_view->visible()); 47 EXPECT_TRUE(in_user_view->visible());
48 48
49 shell_delegate->SetMediaCaptureState(MEDIA_CAPTURE_AUDIO_VIDEO); 49 shell_delegate->SetMediaCaptureState(MEDIA_CAPTURE_AUDIO_VIDEO);
50 EXPECT_TRUE(tray_view->visible()); 50 EXPECT_TRUE(tray_view->visible());
51 EXPECT_TRUE(in_user_view->visible()); 51 EXPECT_TRUE(in_user_view->visible());
52 52
53 shell_delegate->SetMediaCaptureState(MEDIA_CAPTURE_NONE); 53 shell_delegate->SetMediaCaptureState(MEDIA_CAPTURE_NONE);
54 EXPECT_FALSE(tray_view->visible()); 54 EXPECT_FALSE(tray_view->visible());
55 EXPECT_FALSE(in_user_view->visible()); 55 EXPECT_FALSE(in_user_view->visible());
56 } 56 }
57 57
58 } // namespace ash 58 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698