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

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: 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
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..e53bbc55637acbdadf7212abc85d90881e347901 100644
--- a/components/rappor/rappor_metric_unittest.cc
+++ b/components/rappor/rappor_metric_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Change for readability
+
#include "components/rappor/rappor_metric.h"
#include <stdlib.h>
@@ -41,7 +43,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 +54,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]) =

Powered by Google App Engine
This is Rietveld 408576698