| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 } | 859 } |
| 860 GetStatus(); | 860 GetStatus(); |
| 861 EXPECT_EQ(static_cast<int>(DeviceStatusCollector::kMaxResourceUsageSamples), | 861 EXPECT_EQ(static_cast<int>(DeviceStatusCollector::kMaxResourceUsageSamples), |
| 862 status_.system_ram_free().size()); | 862 status_.system_ram_free().size()); |
| 863 EXPECT_TRUE(status_.has_system_ram_total()); | 863 EXPECT_TRUE(status_.has_system_ram_total()); |
| 864 // No good way to inject specific test values for available system RAM, so | 864 // No good way to inject specific test values for available system RAM, so |
| 865 // just make sure it's > 0. | 865 // just make sure it's > 0. |
| 866 EXPECT_GT(status_.system_ram_total(), 0); | 866 EXPECT_GT(status_.system_ram_total(), 0); |
| 867 } | 867 } |
| 868 | 868 |
| 869 TEST_F(DeviceStatusCollectorTest, TestCPUSamples) { | 869 // Test is disabled because it is flaky on Asan bot (See crbug.com/474325) |
| 870 TEST_F(DeviceStatusCollectorTest, DISABLED_TestCPUSamples) { |
| 870 // Mock 100% CPU usage. | 871 // Mock 100% CPU usage. |
| 871 std::string full_cpu_usage("cpu 500 0 500 0 0 0 0"); | 872 std::string full_cpu_usage("cpu 500 0 500 0 0 0 0"); |
| 872 RestartStatusCollector(base::Bind(&GetEmptyVolumeInfo), | 873 RestartStatusCollector(base::Bind(&GetEmptyVolumeInfo), |
| 873 base::Bind(&GetFakeCPUStatistics, full_cpu_usage)); | 874 base::Bind(&GetFakeCPUStatistics, full_cpu_usage)); |
| 874 message_loop_.RunUntilIdle(); | 875 message_loop_.RunUntilIdle(); |
| 875 GetStatus(); | 876 GetStatus(); |
| 876 ASSERT_EQ(1, status_.cpu_utilization_pct().size()); | 877 ASSERT_EQ(1, status_.cpu_utilization_pct().size()); |
| 877 EXPECT_EQ(100, status_.cpu_utilization_pct(0)); | 878 EXPECT_EQ(100, status_.cpu_utilization_pct(0)); |
| 878 | 879 |
| 879 // Now sample CPU usage again (active usage counters will not increase | 880 // Now sample CPU usage again (active usage counters will not increase |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 found_match = true; | 1224 found_match = true; |
| 1224 break; | 1225 break; |
| 1225 } | 1226 } |
| 1226 } | 1227 } |
| 1227 EXPECT_TRUE(found_match) << "No matching state for fake network " | 1228 EXPECT_TRUE(found_match) << "No matching state for fake network " |
| 1228 << " (" << state.name << ")"; | 1229 << " (" << state.name << ")"; |
| 1229 } | 1230 } |
| 1230 } | 1231 } |
| 1231 | 1232 |
| 1232 } // namespace policy | 1233 } // namespace policy |
| OLD | NEW |