Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: components/ukm/ukm_service_unittest.cc

Issue 2717413003: Add support for logging additional metrics in UKM. (Closed)
Patch Set: record URL at nav start Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/metrics/proto/ukm/source.proto ('k') | components/ukm/ukm_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/metrics/proto/ukm/source.proto ('k') | components/ukm/ukm_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698