| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/policy/device_status_collector.h" | 5 #include "chrome/browser/chromeos/policy/device_status_collector.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 session_status_.android_status().droid_guard_info()); | 1012 session_status_.android_status().droid_guard_info()); |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 TEST_F(DeviceStatusCollectorTest, NoAndroidReportingWhenDisabled) { | 1015 TEST_F(DeviceStatusCollectorTest, NoAndroidReportingWhenDisabled) { |
| 1016 RestartStatusCollector(base::Bind(&GetEmptyVolumeInfo), | 1016 RestartStatusCollector(base::Bind(&GetEmptyVolumeInfo), |
| 1017 base::Bind(&GetEmptyCPUStatistics), | 1017 base::Bind(&GetEmptyCPUStatistics), |
| 1018 base::Bind(&GetEmptyCPUTempInfo), | 1018 base::Bind(&GetEmptyCPUTempInfo), |
| 1019 base::Bind(&GetFakeAndroidStatus, kArcStatus, | 1019 base::Bind(&GetFakeAndroidStatus, kArcStatus, |
| 1020 kDroidGuardInfo)); | 1020 kDroidGuardInfo)); |
| 1021 | 1021 |
| 1022 prefs_.SetBoolean(prefs::kReportArcStatus, false); | 1022 prefs_.SetBoolean(prefs::kReportArcStatusEnabled, false); |
| 1023 // Mock Kiosk app, so some session status is reported | 1023 // Mock Kiosk app, so some session status is reported |
| 1024 status_collector_->set_kiosk_account( | 1024 status_collector_->set_kiosk_account( |
| 1025 base::MakeUnique<DeviceLocalAccount>(fake_device_local_account_)); | 1025 base::MakeUnique<DeviceLocalAccount>(fake_device_local_account_)); |
| 1026 MockRunningKioskApp(fake_device_local_account_); | 1026 MockRunningKioskApp(fake_device_local_account_); |
| 1027 | 1027 |
| 1028 GetStatus(); | 1028 GetStatus(); |
| 1029 EXPECT_TRUE(got_session_status_); | 1029 EXPECT_TRUE(got_session_status_); |
| 1030 EXPECT_FALSE(session_status_.has_android_status()); | 1030 EXPECT_FALSE(session_status_.has_android_status()); |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 TEST_F(DeviceStatusCollectorTest, NoSessionStatusIfNotKioskAndNoArcReporting) { | 1033 TEST_F(DeviceStatusCollectorTest, NoSessionStatusIfNotKioskAndNoArcReporting) { |
| 1034 // Should not report session status if we don't have an active kiosk app. | 1034 // Should not report session status if we don't have an active kiosk app. |
| 1035 settings_helper_.SetBoolean(chromeos::kReportDeviceSessionStatus, true); | 1035 settings_helper_.SetBoolean(chromeos::kReportDeviceSessionStatus, true); |
| 1036 prefs_.SetBoolean(prefs::kReportArcStatus, false); | 1036 prefs_.SetBoolean(prefs::kReportArcStatusEnabled, false); |
| 1037 GetStatus(); | 1037 GetStatus(); |
| 1038 EXPECT_FALSE(got_session_status_); | 1038 EXPECT_FALSE(got_session_status_); |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 TEST_F(DeviceStatusCollectorTest, NoSessionStatusIfSessionReportingDisabled) { | 1041 TEST_F(DeviceStatusCollectorTest, NoSessionStatusIfSessionReportingDisabled) { |
| 1042 // Should not report session status if session status reporting is disabled. | 1042 // Should not report session status if session status reporting is disabled. |
| 1043 settings_helper_.SetBoolean(chromeos::kReportDeviceSessionStatus, false); | 1043 settings_helper_.SetBoolean(chromeos::kReportDeviceSessionStatus, false); |
| 1044 // ReportDeviceSessionStatus only controls Kiosk reporting, ARC reporting | 1044 // ReportDeviceSessionStatus only controls Kiosk reporting, ARC reporting |
| 1045 // has to be disabled serarately. | 1045 // has to be disabled serarately. |
| 1046 prefs_.SetBoolean(prefs::kReportArcStatus, false); | 1046 prefs_.SetBoolean(prefs::kReportArcStatusEnabled, false); |
| 1047 status_collector_->set_kiosk_account( | 1047 status_collector_->set_kiosk_account( |
| 1048 base::MakeUnique<policy::DeviceLocalAccount>(fake_device_local_account_)); | 1048 base::MakeUnique<policy::DeviceLocalAccount>(fake_device_local_account_)); |
| 1049 // Set up a device-local account for single-app kiosk mode. | 1049 // Set up a device-local account for single-app kiosk mode. |
| 1050 MockRunningKioskApp(fake_device_local_account_); | 1050 MockRunningKioskApp(fake_device_local_account_); |
| 1051 | 1051 |
| 1052 GetStatus(); | 1052 GetStatus(); |
| 1053 EXPECT_FALSE(got_session_status_); | 1053 EXPECT_FALSE(got_session_status_); |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 TEST_F(DeviceStatusCollectorTest, ReportSessionStatus) { | 1056 TEST_F(DeviceStatusCollectorTest, ReportSessionStatus) { |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 AccountId::FromUserEmail(kPublicAccountId)); | 1487 AccountId::FromUserEmail(kPublicAccountId)); |
| 1488 EXPECT_CALL(*user_manager_, IsLoggedInAsPublicAccount()) | 1488 EXPECT_CALL(*user_manager_, IsLoggedInAsPublicAccount()) |
| 1489 .WillRepeatedly(Return(true)); | 1489 .WillRepeatedly(Return(true)); |
| 1490 | 1490 |
| 1491 settings_helper_.SetBoolean(chromeos::kReportDeviceNetworkInterfaces, true); | 1491 settings_helper_.SetBoolean(chromeos::kReportDeviceNetworkInterfaces, true); |
| 1492 GetStatus(); | 1492 GetStatus(); |
| 1493 VerifyNetworkReporting(); | 1493 VerifyNetworkReporting(); |
| 1494 } | 1494 } |
| 1495 | 1495 |
| 1496 } // namespace policy | 1496 } // namespace policy |
| OLD | NEW |