Index: components/rappor/rappor_metric_unittest.cc |
diff --git a/components/rappor/rappor_metric_unittest.cc b/components/rappor/rappor_metric_unittest.cc |
index b5707cf3aa7f0f0464d6f6631a638784a2deed22..da919030912c47ee12e38d95594a0ca6cc621622 100644 |
--- a/components/rappor/rappor_metric_unittest.cc |
+++ b/components/rappor/rappor_metric_unittest.cc |
@@ -33,7 +33,6 @@ const RapporParameters kTestStatsRapporParameters = { |
// Check for basic syntax and use. |
TEST(RapporMetricTest, BasicMetric) { |
RapporMetric testMetric("MyRappor", kTestRapporParameters, 0); |
- testMetric.AddSample("Foo"); |
testMetric.AddSample("Bar"); |
EXPECT_EQ(0x80, testMetric.bytes()[1]); |
} |
@@ -49,10 +48,12 @@ TEST(RapporMetricTest, GetReport) { |
TEST(RapporMetricTest, GetReportStatistics) { |
RapporMetric metric("MyStatsRappor", kTestStatsRapporParameters, 0); |
- for (char i = 0; i < 50; i++) { |
- metric.AddSample(base::StringPrintf("%d", i)); |
+ ByteVector real_bits(kTestStatsRapporParameters.bloom_filter_size_bytes); |
+ // Set 152 bits (19 bytes) |
+ for (char i = 0; i < 19; i++) { |
+ real_bits[i] = 0xff; |
} |
- const ByteVector real_bits = metric.bytes(); |
+ metric.SetBytesForTesting(real_bits); |
const int real_bit_count = CountBits(real_bits); |
EXPECT_EQ(real_bit_count, 152); |