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

Side by Side Diff: ash/system/chromeos/supervised/tray_supervised_user_unittest.cc

Issue 2058173002: mash: Move SystemTrayDelegate ownership to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/chromeos/supervised/tray_supervised_user.h" 5 #include "ash/system/chromeos/supervised/tray_supervised_user.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/common/wm_shell.h"
8 #include "ash/system/user/login_status.h" 8 #include "ash/system/user/login_status.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/test/test_system_tray_delegate.h" 10 #include "ash/test/test_system_tray_delegate.h"
11 #include "ui/message_center/message_center.h" 11 #include "ui/message_center/message_center.h"
12 #include "ui/message_center/notification.h" 12 #include "ui/message_center/notification.h"
13 #include "ui/message_center/notification_list.h" 13 #include "ui/message_center/notification_list.h"
14 #include "ui/message_center/notification_types.h" 14 #include "ui/message_center/notification_types.h"
15 15
16 using message_center::NotificationList; 16 using message_center::NotificationList;
17 17
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 test::TestSystemTrayDelegate::SetInitialLoginStatus(LoginStatus::SUPERVISED); 56 test::TestSystemTrayDelegate::SetInitialLoginStatus(LoginStatus::SUPERVISED);
57 test::AshTestBase::SetUp(); 57 test::AshTestBase::SetUp();
58 } 58 }
59 59
60 void TraySupervisedUserInitialTest::TearDown() { 60 void TraySupervisedUserInitialTest::TearDown() {
61 test::AshTestBase::TearDown(); 61 test::AshTestBase::TearDown();
62 // SetInitialLoginStatus() is reset in AshTestHelper::TearDown(). 62 // SetInitialLoginStatus() is reset in AshTestHelper::TearDown().
63 } 63 }
64 64
65 TEST_F(TraySupervisedUserTest, SupervisedUserHasNotification) { 65 TEST_F(TraySupervisedUserTest, SupervisedUserHasNotification) {
66 test::TestSystemTrayDelegate* delegate = 66 test::TestSystemTrayDelegate* delegate =
msw 2016/06/10 18:48:21 nit: use AshTestBase::GetSystemTrayDelegate
James Cook 2016/06/10 20:20:32 Done. (I'm glad you noticed these!)
67 static_cast<test::TestSystemTrayDelegate*>( 67 static_cast<test::TestSystemTrayDelegate*>(
68 ash::Shell::GetInstance()->system_tray_delegate()); 68 WmShell::Get()->system_tray_delegate());
69 delegate->SetLoginStatus(LoginStatus::SUPERVISED); 69 delegate->SetLoginStatus(LoginStatus::SUPERVISED);
70 70
71 message_center::Notification* notification = GetPopup(); 71 message_center::Notification* notification = GetPopup();
72 ASSERT_NE(static_cast<message_center::Notification*>(NULL), notification); 72 ASSERT_NE(static_cast<message_center::Notification*>(NULL), notification);
73 EXPECT_EQ(static_cast<int>(message_center::SYSTEM_PRIORITY), 73 EXPECT_EQ(static_cast<int>(message_center::SYSTEM_PRIORITY),
74 notification->rich_notification_data().priority); 74 notification->rich_notification_data().priority);
75 } 75 }
76 76
77 TEST_F(TraySupervisedUserInitialTest, SupervisedUserNoCrash) { 77 TEST_F(TraySupervisedUserInitialTest, SupervisedUserNoCrash) {
78 // Initial login status is already SUPERVISED, which should create 78 // Initial login status is already SUPERVISED, which should create
79 // the notification and should not cause crashes. 79 // the notification and should not cause crashes.
80 message_center::Notification* notification = GetPopup(); 80 message_center::Notification* notification = GetPopup();
81 ASSERT_NE(static_cast<message_center::Notification*>(NULL), notification); 81 ASSERT_NE(static_cast<message_center::Notification*>(NULL), notification);
82 EXPECT_EQ(static_cast<int>(message_center::SYSTEM_PRIORITY), 82 EXPECT_EQ(static_cast<int>(message_center::SYSTEM_PRIORITY),
83 notification->rich_notification_data().priority); 83 notification->rich_notification_data().priority);
84 } 84 }
85 85
86 } // namespace 86 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698