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

Side by Side Diff: components/metrics/metrics_log_unittest.cc

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/metrics/metrics_log.h" 5 #include "components/metrics/metrics_log.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 TestMetricsLog(const std::string& client_id, 46 TestMetricsLog(const std::string& client_id,
47 int session_id, 47 int session_id,
48 LogType log_type, 48 LogType log_type,
49 MetricsServiceClient* client, 49 MetricsServiceClient* client,
50 TestingPrefServiceSimple* prefs) 50 TestingPrefServiceSimple* prefs)
51 : MetricsLog(client_id, session_id, log_type, client, prefs), 51 : MetricsLog(client_id, session_id, log_type, client, prefs),
52 prefs_(prefs) { 52 prefs_(prefs) {
53 InitPrefs(); 53 InitPrefs();
54 } 54 }
55 55
56 virtual ~TestMetricsLog() {} 56 ~TestMetricsLog() override {}
57 57
58 const ChromeUserMetricsExtension& uma_proto() const { 58 const ChromeUserMetricsExtension& uma_proto() const {
59 return *MetricsLog::uma_proto(); 59 return *MetricsLog::uma_proto();
60 } 60 }
61 61
62 const SystemProfileProto& system_profile() const { 62 const SystemProfileProto& system_profile() const {
63 return uma_proto().system_profile(); 63 return uma_proto().system_profile();
64 } 64 }
65 65
66 private: 66 private:
67 void InitPrefs() { 67 void InitPrefs() {
68 prefs_->SetString(prefs::kMetricsReportingEnabledTimestamp, 68 prefs_->SetString(prefs::kMetricsReportingEnabledTimestamp,
69 base::Int64ToString(kEnabledDate)); 69 base::Int64ToString(kEnabledDate));
70 } 70 }
71 71
72 virtual void GetFieldTrialIds( 72 void GetFieldTrialIds(
73 std::vector<variations::ActiveGroupId>* field_trial_ids) const 73 std::vector<variations::ActiveGroupId>* field_trial_ids) const override {
74 override {
75 ASSERT_TRUE(field_trial_ids->empty()); 74 ASSERT_TRUE(field_trial_ids->empty());
76 75
77 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) { 76 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) {
78 field_trial_ids->push_back(kFieldTrialIds[i]); 77 field_trial_ids->push_back(kFieldTrialIds[i]);
79 } 78 }
80 } 79 }
81 80
82 // Weak pointer to the PrefsService used by this log. 81 // Weak pointer to the PrefsService used by this log.
83 TestingPrefServiceSimple* prefs_; 82 TestingPrefServiceSimple* prefs_;
84 83
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 TestMetricsServiceClient client; 399 TestMetricsServiceClient client;
401 client.set_product(kTestProduct); 400 client.set_product(kTestProduct);
402 TestMetricsLog log( 401 TestMetricsLog log(
403 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); 402 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_);
404 // Check that the product is set to |kTestProduct|. 403 // Check that the product is set to |kTestProduct|.
405 EXPECT_TRUE(log.uma_proto().has_product()); 404 EXPECT_TRUE(log.uma_proto().has_product());
406 EXPECT_EQ(kTestProduct, log.uma_proto().product()); 405 EXPECT_EQ(kTestProduct, log.uma_proto().product());
407 } 406 }
408 407
409 } // namespace metrics 408 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/gpu/gpu_metrics_provider_unittest.cc ('k') | components/metrics/metrics_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698