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

Side by Side Diff: ash/common/system/chromeos/media_security/multi_profile_media_tray_item_unittest.cc

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 9 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
(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/media_controller.h"
9 #include "ash/common/system/status_area_widget.h"
10 #include "ash/common/system/tray/system_tray.h"
11 #include "ash/common/system/tray/system_tray_bubble.h"
12 #include "ash/common/system/tray/tray_item_view.h"
13 #include "ash/common/test/test_session_state_delegate.h"
14 #include "ash/common/wm_shell.h"
15 #include "ash/public/interfaces/media.mojom.h"
16 #include "ash/test/ash_test_base.h"
17 #include "ash/test/ash_test_helper.h"
18 #include "ash/test/status_area_widget_test_helper.h"
19 #include "ash/test/test_shell_delegate.h"
20 #include "ui/views/bubble/tray_bubble_view.h"
21
22 namespace ash {
23
24 class MultiProfileMediaTrayItemTest : public test::AshTestBase {
25 public:
26 MultiProfileMediaTrayItemTest() {}
27 ~MultiProfileMediaTrayItemTest() override {}
28
29 void SetMediaCaptureState(mojom::MediaCaptureState state) {
30 // Create the fake update.
31 test::TestSessionStateDelegate* session_state_delegate =
32 test::AshTestHelper::GetTestSessionStateDelegate();
33 std::vector<mojom::MediaCaptureState> v;
34 for (int i = 0; i < session_state_delegate->NumberOfLoggedInUsers(); ++i)
35 v.push_back(state);
36 WmShell::Get()->media_controller()->NotifyCaptureState(v);
37 }
38
39 private:
40 DISALLOW_COPY_AND_ASSIGN(MultiProfileMediaTrayItemTest);
41 };
42
43 // ash_unittests. still failing.
44 TEST_F(MultiProfileMediaTrayItemTest, NotifyMediaCaptureChange) {
45 TrayItemView::DisableAnimationsForTest();
46 test::TestSessionStateDelegate* session_state_delegate =
47 test::AshTestHelper::GetTestSessionStateDelegate();
48 session_state_delegate->set_logged_in_users(2);
49
50 SystemTray* system_tray = GetPrimarySystemTray();
51 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW);
52 views::View* in_user_view =
53 system_tray->GetSystemBubble()->bubble_view()->GetViewByID(
54 VIEW_ID_USER_VIEW_MEDIA_INDICATOR);
55
56 StatusAreaWidget* widget = StatusAreaWidgetTestHelper::GetStatusAreaWidget();
57 EXPECT_TRUE(widget->GetRootView()->visible());
58 views::View* tray_view =
59 widget->GetRootView()->GetViewByID(VIEW_ID_MEDIA_TRAY_VIEW);
60
61 SetMediaCaptureState(mojom::MediaCaptureState::NONE);
62 EXPECT_FALSE(tray_view->visible());
63 EXPECT_FALSE(in_user_view->visible());
64
65 SetMediaCaptureState(mojom::MediaCaptureState::AUDIO);
66 EXPECT_TRUE(tray_view->visible());
67 EXPECT_TRUE(in_user_view->visible());
68
69 SetMediaCaptureState(mojom::MediaCaptureState::AUDIO_VIDEO);
70 EXPECT_TRUE(tray_view->visible());
71 EXPECT_TRUE(in_user_view->visible());
72
73 SetMediaCaptureState(mojom::MediaCaptureState::NONE);
74 EXPECT_FALSE(tray_view->visible());
75 EXPECT_FALSE(in_user_view->visible());
76 }
77
78 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/media_security/multi_profile_media_tray_item.cc ('k') | ash/common/system/chromeos/network/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698