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

Unified Diff: components/rappor/rappor_service_unittest.cc

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Fix an Android compile error Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: components/rappor/rappor_service_unittest.cc
diff --git a/components/rappor/rappor_service_unittest.cc b/components/rappor/rappor_service_unittest.cc
index 2c1e8b6ce6802a25044c8e5e6a5093e711794a5d..948052ddb2d15511d84e34d6c9d576ac5cc14fbc 100644
--- a/components/rappor/rappor_service_unittest.cc
+++ b/components/rappor/rappor_service_unittest.cc
@@ -15,7 +15,7 @@
#include "components/prefs/testing_pref_service.h"
#include "components/rappor/byte_vector_utils.h"
#include "components/rappor/proto/rappor_metric.pb.h"
-#include "components/rappor/rappor_parameters.h"
+#include "components/rappor/public/rappor_parameters.h"
#include "components/rappor/rappor_pref_names.h"
#include "components/rappor/test_log_uploader.h"
#include "components/rappor/test_rappor_service.h"
@@ -51,8 +51,10 @@ TEST(RapporServiceTest, RecordAndExportMetrics) {
TestRapporService rappor_service;
// Multiple samples for the same metric should only generate one report.
- rappor_service.RecordSample("MyMetric", ETLD_PLUS_ONE_RAPPOR_TYPE, "foo");
- rappor_service.RecordSample("MyMetric", ETLD_PLUS_ONE_RAPPOR_TYPE, "bar");
+ rappor_service.RecordSampleString("MyMetric", ETLD_PLUS_ONE_RAPPOR_TYPE,
+ "foo");
+ rappor_service.RecordSampleString("MyMetric", ETLD_PLUS_ONE_RAPPOR_TYPE,
+ "bar");
RapporReports reports;
rappor_service.GetReports(&reports);
@@ -70,7 +72,7 @@ TEST(RapporServiceTest, UmaRecordingGroup) {
rappor_service.Update(SAFEBROWSING_RAPPOR_GROUP, false);
// Wrong recording group.
- rappor_service.RecordSample("UmaMetric", UMA_RAPPOR_TYPE, "foo");
+ rappor_service.RecordSampleString("UmaMetric", UMA_RAPPOR_TYPE, "foo");
RapporReports reports;
rappor_service.GetReports(&reports);
@@ -83,7 +85,8 @@ TEST(RapporServiceTest, SafeBrowsingRecordingGroup) {
rappor_service.Update(UMA_RAPPOR_GROUP, false);
// Wrong recording group.
- rappor_service.RecordSample("SbMetric", SAFEBROWSING_RAPPOR_TYPE, "foo");
+ rappor_service.RecordSampleString("SbMetric", SAFEBROWSING_RAPPOR_TYPE,
+ "foo");
RapporReports reports;
rappor_service.GetReports(&reports);
@@ -95,8 +98,10 @@ TEST(RapporServiceTest, GetRecordedSampleForMetric) {
TestRapporService rappor_service;
// Multiple samples for the same metric; only the latest is remembered.
- rappor_service.RecordSample("MyMetric", ETLD_PLUS_ONE_RAPPOR_TYPE, "foo");
- rappor_service.RecordSample("MyMetric", ETLD_PLUS_ONE_RAPPOR_TYPE, "bar");
+ rappor_service.RecordSampleString("MyMetric", ETLD_PLUS_ONE_RAPPOR_TYPE,
+ "foo");
+ rappor_service.RecordSampleString("MyMetric", ETLD_PLUS_ONE_RAPPOR_TYPE,
+ "bar");
std::string sample;
RapporType type;
@@ -113,7 +118,8 @@ TEST(RapporServiceTest, Incognito) {
TestRapporService rappor_service;
rappor_service.set_is_incognito(true);
- rappor_service.RecordSample("MyMetric", SAFEBROWSING_RAPPOR_TYPE, "foo");
+ rappor_service.RecordSampleString("MyMetric", SAFEBROWSING_RAPPOR_TYPE,
+ "foo");
RapporReports reports;
rappor_service.GetReports(&reports);
@@ -127,7 +133,7 @@ TEST(RapporServiceTest, RecordSample) {
rappor_service.CreateSample(SAFEBROWSING_RAPPOR_TYPE);
sample->SetStringField("Url", "example.com");
sample->SetFlagsField("Flags1", 0xbcd, 12);
- rappor_service.RecordSampleObj("ObjMetric", std::move(sample));
+ rappor_service.RecordSample("ObjMetric", std::move(sample));
uint64_t url_hash = base::HashMetricName("ObjMetric.Url");
uint64_t flags_hash = base::HashMetricName("ObjMetric.Flags1");
RapporReports reports;

Powered by Google App Engine
This is Rietveld 408576698