| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/ukm/ukm_service.h" | 5 #include "components/ukm/ukm_service.h" |
| 6 | 6 |
| 7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "components/metrics/test_metrics_service_client.h" | 9 #include "components/metrics/test_metrics_service_client.h" |
| 10 #include "components/prefs/testing_pref_service.h" | 10 #include "components/prefs/testing_pref_service.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 service.EnableReporting(); | 66 service.EnableReporting(); |
| 67 // Should init, generate a log, and unsuccessfully attempt an upload. | 67 // Should init, generate a log, and unsuccessfully attempt an upload. |
| 68 task_runner_->RunPendingTasks(); | 68 task_runner_->RunPendingTasks(); |
| 69 // Flushes the generated log to disk and generates a new one. | 69 // Flushes the generated log to disk and generates a new one. |
| 70 service.Flush(); | 70 service.Flush(); |
| 71 EXPECT_EQ(GetPersistedLogCount(), 2); | 71 EXPECT_EQ(GetPersistedLogCount(), 2); |
| 72 service.Purge(); | 72 service.Purge(); |
| 73 EXPECT_EQ(GetPersistedLogCount(), 0); | 73 EXPECT_EQ(GetPersistedLogCount(), 0); |
| 74 } | 74 } |
| 75 | 75 |
| 76 TEST_F(UkmServiceTest, PopulateSystemProfile) { |
| 77 UkmService service(&prefs_, &client_); |
| 78 Report report; |
| 79 service.PopulateSystemProfile(&report); |
| 80 EXPECT_TRUE(report.system_profile().has_build_timestamp()); |
| 81 EXPECT_TRUE(report.system_profile().has_app_version()); |
| 82 EXPECT_TRUE(report.system_profile().has_channel()); |
| 83 EXPECT_TRUE(report.system_profile().has_application_locale()); |
| 84 EXPECT_TRUE(report.system_profile().os().has_name()); |
| 85 EXPECT_TRUE(report.system_profile().os().has_version()); |
| 86 EXPECT_TRUE(report.system_profile().hardware().has_cpu_architecture()); |
| 87 EXPECT_TRUE(report.system_profile().hardware().has_system_ram_mb()); |
| 88 EXPECT_TRUE(report.system_profile().hardware().has_hardware_class()); |
| 89 } |
| 90 |
| 76 } // namespace ukm | 91 } // namespace ukm |
| OLD | NEW |