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

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

Issue 2737953002: UKM: Remove UkmService::RecordSource (Closed)
Patch Set: 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
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/test_ukm_service.h" 5 #include "components/ukm/test_ukm_service.h"
6 6
7 namespace ukm { 7 namespace ukm {
8 8
9 UkmServiceTestingHarness::UkmServiceTestingHarness() { 9 UkmServiceTestingHarness::UkmServiceTestingHarness() {
10 UkmService::RegisterPrefs(test_prefs_.registry()); 10 UkmService::RegisterPrefs(test_prefs_.registry());
11 test_prefs_.ClearPref(prefs::kUkmClientId); 11 test_prefs_.ClearPref(prefs::kUkmClientId);
12 test_prefs_.ClearPref(prefs::kUkmSessionId); 12 test_prefs_.ClearPref(prefs::kUkmSessionId);
13 test_prefs_.ClearPref(prefs::kUkmPersistedLogs); 13 test_prefs_.ClearPref(prefs::kUkmPersistedLogs);
14 14
15 test_ukm_service_ = base::MakeUnique<TestUkmService>(&test_prefs_); 15 test_ukm_service_ = base::MakeUnique<TestUkmService>(&test_prefs_);
16 } 16 }
17 17
18 UkmServiceTestingHarness::~UkmServiceTestingHarness() = default; 18 UkmServiceTestingHarness::~UkmServiceTestingHarness() = default;
19 19
20 TestUkmService::TestUkmService(PrefService* prefs_service) 20 TestUkmService::TestUkmService(PrefService* prefs_service)
21 : UkmService(prefs_service, &test_metrics_service_client_) { 21 : UkmService(prefs_service, &test_metrics_service_client_) {
22 EnableRecording(); 22 EnableRecording();
23 DisableReporting(); 23 DisableReporting();
24 } 24 }
25 25
26 TestUkmService::~TestUkmService() = default; 26 TestUkmService::~TestUkmService() = default;
27 27
28 const UkmSource* TestUkmService::GetSource(size_t source_num) const { 28 const std::map<int32_t, std::unique_ptr<UkmSource>>&
29 return sources_for_testing()[source_num].get(); 29 TestUkmService::GetSources() const {
30 return sources_for_testing();
30 } 31 }
31 32
32 const UkmEntry* TestUkmService::GetEntry(size_t entry_num) const { 33 const UkmEntry* TestUkmService::GetEntry(size_t entry_num) const {
33 return entries_for_testing()[entry_num].get(); 34 return entries_for_testing()[entry_num].get();
34 } 35 }
35 36
36 } // namespace ukm 37 } // namespace ukm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698