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

Side by Side Diff: chrome/browser/extensions/activity_log/ad_injection_unittest.cc

Issue 509203002: Create a mechanism for reporting rappor metrics from non-UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | components/rappor/rappor_metric.cc » ('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 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 "base/prefs/testing_pref_service.h" 5 #include "base/prefs/testing_pref_service.h"
6 #include "base/time/time.h" 6 #include "base/time/time.h"
7 #include "chrome/browser/extensions/activity_log/activity_actions.h" 7 #include "chrome/browser/extensions/activity_log/activity_actions.h"
8 #include "components/rappor/byte_vector_utils.h" 8 #include "components/rappor/byte_vector_utils.h"
9 #include "components/rappor/proto/rappor_metric.pb.h" 9 #include "components/rappor/proto/rappor_metric.pb.h"
10 #include "components/rappor/rappor_service.h" 10 #include "components/rappor/rappor_service.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // the test). 44 // the test).
45 rappor::RapporReports GetReports(); 45 rappor::RapporReports GetReports();
46 46
47 protected: 47 protected:
48 TestingPrefServiceSimple prefs_; 48 TestingPrefServiceSimple prefs_;
49 }; 49 };
50 50
51 TestRapporService::TestRapporService() 51 TestRapporService::TestRapporService()
52 : rappor::RapporService(&prefs_) { 52 : rappor::RapporService(&prefs_) {
53 // Initialize the RapporService for testing. 53 // Initialize the RapporService for testing.
54 SetCohortForTesting(0); 54 Initialize(0,
55 SetSecretForTesting(rappor::HmacByteVectorGenerator::GenerateEntropyInput()); 55 rappor::HmacByteVectorGenerator::GenerateEntropyInput(),
56 rappor::FINE_LEVEL);
56 } 57 }
57 58
58 TestRapporService::~TestRapporService() {} 59 TestRapporService::~TestRapporService() {}
59 60
60 rappor::RapporReports TestRapporService::GetReports() { 61 rappor::RapporReports TestRapporService::GetReports() {
61 rappor::RapporReports result; 62 rappor::RapporReports result;
62 rappor::RapporService::ExportMetrics(&result); 63 rappor::RapporService::ExportMetrics(&result);
63 return result; 64 return result;
64 } 65 }
65 66
(...skipping 17 matching lines...) Expand all
83 EXPECT_EQ(1, reports.report_size()); 84 EXPECT_EQ(1, reports.report_size());
84 85
85 scoped_refptr<Action> harmless_action = 86 scoped_refptr<Action> harmless_action =
86 CreateAction("Location.replace", "", ""); 87 CreateAction("Location.replace", "", "");
87 harmless_action->DidInjectAd(&rappor_service); 88 harmless_action->DidInjectAd(&rappor_service);
88 reports = rappor_service.GetReports(); 89 reports = rappor_service.GetReports();
89 EXPECT_EQ(0, reports.report_size()); 90 EXPECT_EQ(0, reports.report_size());
90 } 91 }
91 92
92 } // namespace extensions 93 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | components/rappor/rappor_metric.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698