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

Unified Diff: components/rappor/rappor_metric_unittest.cc

Issue 419683014: Randomly select a single rappor sample when more than one is collected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « components/rappor/rappor_metric.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « components/rappor/rappor_metric.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698