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

Unified Diff: components/rappor/rappor_metric_unittest.cc

Issue 188103004: C++ Readability review for holte (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix struct/class declaration Created 6 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
« no previous file with comments | « components/rappor/rappor_metric.cc ('k') | components/rappor/rappor_service.h » ('j') | 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 bbcb1ab36055ac2dacbc41c850d62b9f2ec1d7b8..7c50fd47327620372a2e4737508e85f7f9097413 100644
--- a/components/rappor/rappor_metric_unittest.cc
+++ b/components/rappor/rappor_metric_unittest.cc
@@ -18,8 +18,7 @@ const RapporParameters kTestRapporParameters = {
PROBABILITY_75 /* Fake data probability */,
PROBABILITY_50 /* Fake one probability */,
PROBABILITY_75 /* One coin probability */,
- PROBABILITY_50 /* Zero coin probability */
-};
+ PROBABILITY_50 /* Zero coin probability */};
const RapporParameters kTestStatsRapporParameters = {
50 /* Bloom filter size bytes */,
@@ -27,8 +26,7 @@ const RapporParameters kTestStatsRapporParameters = {
PROBABILITY_75 /* Fake data probability */,
PROBABILITY_50 /* Fake one probability */,
PROBABILITY_75 /* One coin probability */,
- PROBABILITY_50 /* Zero coin probability */
-};
+ PROBABILITY_50 /* Zero coin probability */};
// Check for basic syntax and use.
TEST(RapporMetricTest, BasicMetric) {
@@ -41,7 +39,7 @@ TEST(RapporMetricTest, BasicMetric) {
TEST(RapporMetricTest, GetReport) {
RapporMetric metric("MyRappor", kTestRapporParameters, 0);
- ByteVector report = metric.GetReport(
+ const ByteVector report = metric.GetReport(
HmacByteVectorGenerator::GenerateEntropyInput());
EXPECT_EQ(16u, report.size());
}
@@ -52,25 +50,26 @@ TEST(RapporMetricTest, GetReportStatistics) {
for (char i = 0; i < 50; i++) {
metric.AddSample(base::StringPrintf("%d", i));
}
- ByteVector real_bits = metric.bytes();
- int real_bit_count = CountBits(real_bits);
+ const ByteVector real_bits = metric.bytes();
+ const int real_bit_count = CountBits(real_bits);
EXPECT_EQ(real_bit_count, 152);
- std::string secret = HmacByteVectorGenerator::GenerateEntropyInput();
- ByteVector report = metric.GetReport(secret);
+ const std::string secret = HmacByteVectorGenerator::GenerateEntropyInput();
+ const ByteVector report = metric.GetReport(secret);
- // For the bits we actually set in the bloom filter, get a count of how
+ // For the bits we actually set in the Bloom filter, get a count of how
// many of them reported true.
ByteVector from_true_reports = report;
// Real bits AND report bits.
ByteVectorMerge(real_bits, real_bits, &from_true_reports);
- int true_from_true_count = CountBits(from_true_reports);
+ const int true_from_true_count = CountBits(from_true_reports);
- // For the bits we didn't set in the bloom filter, get a count of how
+ // For the bits we didn't set in the Bloom filter, get a count of how
// many of them reported true.
ByteVector from_false_reports = report;
ByteVectorOr(real_bits, &from_false_reports);
- int true_from_false_count = CountBits(from_false_reports) - real_bit_count;
+ const int true_from_false_count =
+ CountBits(from_false_reports) - real_bit_count;
// The probability of a true bit being true after redaction =
// [fake_prob]*[fake_true_prob] + (1-[fake_prob]) =
« no previous file with comments | « components/rappor/rappor_metric.cc ('k') | components/rappor/rappor_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698