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

Unified Diff: components/rappor/rappor_metric_unittest.cc

Issue 1058333002: Multi-dimension rappor metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/rappor/rappor_metric_unittest.cc
diff --git a/components/rappor/rappor_metric_unittest.cc b/components/rappor/rappor_metric_unittest.cc
index b8e28dd3a71985b27dc3099985b0506e68033c31..3dd201e1457370412da749e477c90ce482366ed0 100644
--- a/components/rappor/rappor_metric_unittest.cc
+++ b/components/rappor/rappor_metric_unittest.cc
@@ -14,8 +14,9 @@ namespace rappor {
const RapporParameters kTestRapporParameters = {
1 /* Num cohorts */,
- 16 /* Bloom filter size bytes */,
+ 8 /* Bloom filter size bytes */,
4 /* Bloom filter hash count */,
+ 8,
PROBABILITY_75 /* Fake data probability */,
PROBABILITY_50 /* Fake one probability */,
PROBABILITY_75 /* One coin probability */,
@@ -26,21 +27,15 @@ const RapporParameters kTestStatsRapporParameters = {
1 /* Num cohorts */,
50 /* Bloom filter size bytes */,
4 /* Bloom filter hash count */,
+ 0,
PROBABILITY_75 /* Fake data probability */,
PROBABILITY_50 /* Fake one probability */,
PROBABILITY_75 /* One coin probability */,
PROBABILITY_50 /* Zero coin probability */,
FINE_LEVEL /* Reporting level (not used) */};
-// Check for basic syntax and use.
-TEST(RapporMetricTest, BasicMetric) {
- RapporMetric testMetric("MyRappor", kTestRapporParameters, 0);
- testMetric.AddSample("Bar");
- EXPECT_EQ(0x80, testMetric.bytes()[1]);
-}
-
TEST(RapporMetricTest, GetReport) {
- RapporMetric metric("MyRappor", kTestRapporParameters, 0);
+ RapporMetric metric("MyRappor", kTestRapporParameters);
const ByteVector report = metric.GetReport(
HmacByteVectorGenerator::GenerateEntropyInput());
@@ -48,14 +43,14 @@ TEST(RapporMetricTest, GetReport) {
}
TEST(RapporMetricTest, GetReportStatistics) {
- RapporMetric metric("MyStatsRappor", kTestStatsRapporParameters, 0);
+ RapporMetric metric("MyStatsRappor", kTestStatsRapporParameters);
ByteVector real_bits(kTestStatsRapporParameters.bloom_filter_size_bytes);
// Set 152 bits (19 bytes)
for (char i = 0; i < 19; i++) {
real_bits[i] = 0xff;
}
- metric.SetBytesForTesting(real_bits);
+ metric.AddSample(real_bits);
const int real_bit_count = CountBits(real_bits);
EXPECT_EQ(real_bit_count, 152);

Powered by Google App Engine
This is Rietveld 408576698