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

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: Seperated log generation and uploading 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) {
20 log->RecordRapporMetrics();
21 }
22 };
23
24 TEST_F(RapporServiceTest, RapporMetrics) {
25 RapporService log;
26 RAPPOR_SAMPLE("MyRappor", "foo");
27
28 RecordRapporMetrics(&log);
29
30 RapporMetricsProto* proto = GetProto(&log);
31 EXPECT_EQ(1, proto->rappor_size());
32
33 const RapporMetricsProto::RapporMetricProto& rappor_proto =
34 proto->rappor(0);
35 EXPECT_TRUE(rappor_proto.name_hash());
36 EXPECT_EQ(16u, rappor_proto.bits().size());
37 }
38
39 } // namespace rappor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698