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

Side by Side Diff: components/rappor/rappor_service_unittest.cc

Issue 49753002: RAPPOR implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/rappor/rappor_service.h"
6
7 #include <string>
8
9 #include "components/rappor/rappor_recorder.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace rappor {
13
14 class RapporServiceTest : public testing::Test {
15 public:
16 RapporMetricsProto* GetProto(RapporService* log) {
17 return &(log->rappor_metrics_proto_);
18 }
19 void RecordRapporMetrics(RapporService* log) { log->RecordRapporMetrics(); }
20 };
21
22 TEST_F(RapporServiceTest, RapporMetrics) {
23 RapporService log;
24 std::vector<std::string> samples;
25 samples.push_back("foo");
26 RAPPOR_SAMPLES("MyRappor", samples);
27
28 RecordRapporMetrics(&log);
29
30 RapporMetricsProto* proto = GetProto(&log);
31 EXPECT_EQ(1, proto->rappor_size());
32
33 const RapporMetricsProto::RapporMetricProto& rappor_proto = proto->rappor(0);
34 EXPECT_TRUE(rappor_proto.name_hash());
35 EXPECT_EQ(16u, rappor_proto.bits().size());
36 }
37
38 } // namespace rappor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698