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 <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/test/test_simple_task_runner.h" | 10 #include "base/test/test_simple_task_runner.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 EXPECT_TRUE(compression::GzipUncompress(result_persisted_logs.staged_log(), | 56 EXPECT_TRUE(compression::GzipUncompress(result_persisted_logs.staged_log(), |
57 &uncompressed_log_data)); | 57 &uncompressed_log_data)); |
58 | 58 |
59 Report report; | 59 Report report; |
60 EXPECT_TRUE(report.ParseFromString(uncompressed_log_data)); | 60 EXPECT_TRUE(report.ParseFromString(uncompressed_log_data)); |
61 return report; | 61 return report; |
62 } | 62 } |
63 | 63 |
64 std::unique_ptr<UkmSource> MakeSource(std::string url, int paint_msec) { | 64 std::unique_ptr<UkmSource> MakeSource(std::string url, int paint_msec) { |
65 auto source = base::MakeUnique<UkmSource>(); | 65 auto source = base::MakeUnique<UkmSource>(); |
66 source->set_committed_url(GURL(url)); | 66 source->set_url(GURL(url)); |
67 source->set_first_contentful_paint( | 67 source->set_first_contentful_paint( |
68 base::TimeDelta::FromMilliseconds(paint_msec)); | 68 base::TimeDelta::FromMilliseconds(paint_msec)); |
69 return source; | 69 return source; |
70 } | 70 } |
71 | 71 |
72 protected: | 72 protected: |
73 TestingPrefServiceSimple prefs_; | 73 TestingPrefServiceSimple prefs_; |
74 metrics::TestMetricsServiceClient client_; | 74 metrics::TestMetricsServiceClient client_; |
75 | 75 |
76 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 76 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Includes a Source, so will persist. | 182 // Includes a Source, so will persist. |
183 service.Flush(); | 183 service.Flush(); |
184 EXPECT_EQ(GetPersistedLogCount(), 1); | 184 EXPECT_EQ(GetPersistedLogCount(), 1); |
185 | 185 |
186 // Current log has no Sources. | 186 // Current log has no Sources. |
187 service.Flush(); | 187 service.Flush(); |
188 EXPECT_EQ(GetPersistedLogCount(), 1); | 188 EXPECT_EQ(GetPersistedLogCount(), 1); |
189 } | 189 } |
190 | 190 |
191 } // namespace ukm | 191 } // namespace ukm |
OLD | NEW |