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

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

Issue 2041233005: Moves ash::user::LoginStatus to ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test 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/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"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 ~TraySupervisedUserInitialTest() override {} 46 ~TraySupervisedUserInitialTest() override {}
47 47
48 void SetUp() override; 48 void SetUp() override;
49 void TearDown() override; 49 void TearDown() override;
50 50
51 private: 51 private:
52 DISALLOW_COPY_AND_ASSIGN(TraySupervisedUserInitialTest); 52 DISALLOW_COPY_AND_ASSIGN(TraySupervisedUserInitialTest);
53 }; 53 };
54 54
55 void TraySupervisedUserInitialTest::SetUp() { 55 void TraySupervisedUserInitialTest::SetUp() {
56 test::TestSystemTrayDelegate::SetInitialLoginStatus( 56 test::TestSystemTrayDelegate::SetInitialLoginStatus(LoginStatus::SUPERVISED);
57 user::LOGGED_IN_SUPERVISED);
58 test::AshTestBase::SetUp(); 57 test::AshTestBase::SetUp();
59 } 58 }
60 59
61 void TraySupervisedUserInitialTest::TearDown() { 60 void TraySupervisedUserInitialTest::TearDown() {
62 test::AshTestBase::TearDown(); 61 test::AshTestBase::TearDown();
63 // SetInitialLoginStatus() is reset in AshTestHelper::TearDown(). 62 // SetInitialLoginStatus() is reset in AshTestHelper::TearDown().
64 } 63 }
65 64
66 TEST_F(TraySupervisedUserTest, SupervisedUserHasNotification) { 65 TEST_F(TraySupervisedUserTest, SupervisedUserHasNotification) {
67 test::TestSystemTrayDelegate* delegate = 66 test::TestSystemTrayDelegate* delegate =
68 static_cast<test::TestSystemTrayDelegate*>( 67 static_cast<test::TestSystemTrayDelegate*>(
69 ash::Shell::GetInstance()->system_tray_delegate()); 68 ash::Shell::GetInstance()->system_tray_delegate());
70 delegate->SetLoginStatus(user::LOGGED_IN_SUPERVISED); 69 delegate->SetLoginStatus(LoginStatus::SUPERVISED);
71 70
72 message_center::Notification* notification = GetPopup(); 71 message_center::Notification* notification = GetPopup();
73 ASSERT_NE(static_cast<message_center::Notification*>(NULL), notification); 72 ASSERT_NE(static_cast<message_center::Notification*>(NULL), notification);
74 EXPECT_EQ(static_cast<int>(message_center::SYSTEM_PRIORITY), 73 EXPECT_EQ(static_cast<int>(message_center::SYSTEM_PRIORITY),
75 notification->rich_notification_data().priority); 74 notification->rich_notification_data().priority);
76 } 75 }
77 76
78 TEST_F(TraySupervisedUserInitialTest, SupervisedUserNoCrash) { 77 TEST_F(TraySupervisedUserInitialTest, SupervisedUserNoCrash) {
79 // Initial login status is already SUPERVISED, which should create 78 // Initial login status is already SUPERVISED, which should create
80 // the notification and should not cause crashes. 79 // the notification and should not cause crashes.
81 message_center::Notification* notification = GetPopup(); 80 message_center::Notification* notification = GetPopup();
82 ASSERT_NE(static_cast<message_center::Notification*>(NULL), notification); 81 ASSERT_NE(static_cast<message_center::Notification*>(NULL), notification);
83 EXPECT_EQ(static_cast<int>(message_center::SYSTEM_PRIORITY), 82 EXPECT_EQ(static_cast<int>(message_center::SYSTEM_PRIORITY),
84 notification->rich_notification_data().priority); 83 notification->rich_notification_data().priority);
85 } 84 }
86 85
87 } // namespace 86 } // namespace
OLDNEW
« no previous file with comments | « ash/system/chromeos/supervised/tray_supervised_user.cc ('k') | ash/system/chromeos/tray_caps_lock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698