| Index: chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
|
| diff --git a/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
|
| index 4f683f78dbad7b574103d386436d8648bf7ea1ed..89c4ec8df138521e40d4673d77327ce10a82e19e 100644
|
| --- a/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
|
| +++ b/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
|
| @@ -86,12 +86,15 @@ class TestingDeviceStatusCollector : public policy::DeviceStatusCollector {
|
| const policy::DeviceStatusCollector::VolumeInfoFetcher&
|
| volume_info_fetcher,
|
| const policy::DeviceStatusCollector::CPUStatisticsFetcher& cpu_fetcher,
|
| - const policy::DeviceStatusCollector::CPUTempFetcher& cpu_temp_fetcher)
|
| + const policy::DeviceStatusCollector::CPUTempFetcher& cpu_temp_fetcher,
|
| + const policy::DeviceStatusCollector::AndroidStatusFetcher&
|
| + android_status_fetcher)
|
| : policy::DeviceStatusCollector(local_state,
|
| provider,
|
| volume_info_fetcher,
|
| cpu_fetcher,
|
| - cpu_temp_fetcher) {
|
| + cpu_temp_fetcher,
|
| + android_status_fetcher) {
|
| // Set the baseline time to a fixed value (1 AM) to prevent test flakiness
|
| // due to a single activity period spanning two days.
|
| SetBaselineTime(Time::Now().LocalMidnight() + TimeDelta::FromHours(1));
|
| @@ -212,6 +215,10 @@ std::vector<em::CPUTempInfo> GetEmptyCPUTempInfo() {
|
| return std::vector<em::CPUTempInfo>();
|
| }
|
|
|
| +std::pair<mojo::String, mojo::String> GetEmptyAndroidStatus() {
|
| + return std::pair<mojo::String, mojo::String>("", "");
|
| +}
|
| +
|
| std::vector<em::CPUTempInfo> GetFakeCPUTempInfo(
|
| const std::vector<em::CPUTempInfo>& cpu_temp_info) {
|
| return cpu_temp_info;
|
| @@ -281,7 +288,8 @@ class DeviceStatusCollectorTest : public testing::Test {
|
|
|
| RestartStatusCollector(base::Bind(&GetEmptyVolumeInfo),
|
| base::Bind(&GetEmptyCPUStatistics),
|
| - base::Bind(&GetEmptyCPUTempInfo));
|
| + base::Bind(&GetEmptyCPUTempInfo),
|
| + base::Bind(&GetEmptyAndroidStatus));
|
|
|
| // Set up a fake local state for KioskAppManager.
|
| TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_);
|
| @@ -326,11 +334,13 @@ class DeviceStatusCollectorTest : public testing::Test {
|
| void RestartStatusCollector(
|
| const policy::DeviceStatusCollector::VolumeInfoFetcher& volume_info,
|
| const policy::DeviceStatusCollector::CPUStatisticsFetcher& cpu_stats,
|
| - const policy::DeviceStatusCollector::CPUTempFetcher& cpu_temp_fetcher) {
|
| + const policy::DeviceStatusCollector::CPUTempFetcher& cpu_temp_fetcher,
|
| + const policy::DeviceStatusCollector::AndroidStatusFetcher&
|
| + android_status_fetcher) {
|
| std::vector<em::VolumeInfo> expected_volume_info;
|
| status_collector_.reset(new TestingDeviceStatusCollector(
|
| &prefs_, &fake_statistics_provider_, volume_info, cpu_stats,
|
| - cpu_temp_fetcher));
|
| + cpu_temp_fetcher, android_status_fetcher));
|
| }
|
|
|
| void GetStatus() {
|
| @@ -521,7 +531,8 @@ TEST_F(DeviceStatusCollectorTest, StateKeptInPref) {
|
| // the results are stored in a pref.
|
| RestartStatusCollector(base::Bind(&GetEmptyVolumeInfo),
|
| base::Bind(&GetEmptyCPUStatistics),
|
| - base::Bind(&GetEmptyCPUTempInfo));
|
| + base::Bind(&GetEmptyCPUTempInfo),
|
| + base::Bind(&GetEmptyAndroidStatus));
|
| status_collector_->Simulate(test_states,
|
| sizeof(test_states) / sizeof(ui::IdleState));
|
|
|
| @@ -821,7 +832,8 @@ TEST_F(DeviceStatusCollectorTest, TestVolumeInfo) {
|
|
|
| RestartStatusCollector(base::Bind(&GetFakeVolumeInfo, expected_volume_info),
|
| base::Bind(&GetEmptyCPUStatistics),
|
| - base::Bind(&GetEmptyCPUTempInfo));
|
| + base::Bind(&GetEmptyCPUTempInfo),
|
| + base::Bind(&GetEmptyAndroidStatus));
|
| // Force finishing tasks posted by ctor of DeviceStatusCollector.
|
| content::BrowserThread::GetBlockingPool()->FlushForTesting();
|
| base::RunLoop().RunUntilIdle();
|
| @@ -874,7 +886,8 @@ TEST_F(DeviceStatusCollectorTest, TestCPUSamples) {
|
| std::string full_cpu_usage("cpu 500 0 500 0 0 0 0");
|
| RestartStatusCollector(base::Bind(&GetEmptyVolumeInfo),
|
| base::Bind(&GetFakeCPUStatistics, full_cpu_usage),
|
| - base::Bind(&GetEmptyCPUTempInfo));
|
| + base::Bind(&GetEmptyCPUTempInfo),
|
| + base::Bind(&GetEmptyAndroidStatus));
|
| // Force finishing tasks posted by ctor of DeviceStatusCollector.
|
| content::BrowserThread::GetBlockingPool()->FlushForTesting();
|
| base::RunLoop().RunUntilIdle();
|
| @@ -925,7 +938,8 @@ TEST_F(DeviceStatusCollectorTest, TestCPUTemp) {
|
|
|
| RestartStatusCollector(base::Bind(&GetEmptyVolumeInfo),
|
| base::Bind(&GetEmptyCPUStatistics),
|
| - base::Bind(&GetFakeCPUTempInfo, expected_temp_info));
|
| + base::Bind(&GetFakeCPUTempInfo, expected_temp_info),
|
| + base::Bind(&GetEmptyAndroidStatus));
|
| // Force finishing tasks posted by ctor of DeviceStatusCollector.
|
| content::BrowserThread::GetBlockingPool()->FlushForTesting();
|
| base::RunLoop().RunUntilIdle();
|
|
|