ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / components / rappor / test_rappor_service.cc
blobf355cb633b2e9c6a8941e6729b54145b97302a27
1 // Copyright 2014 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.
5 #include "components/rappor/test_rappor_service.h"
7 #include "components/rappor/byte_vector_utils.h"
8 #include "components/rappor/proto/rappor_metric.pb.h"
9 #include "components/rappor/rappor_parameters.h"
10 #include "components/rappor/rappor_prefs.h"
11 #include "components/rappor/test_log_uploader.h"
13 namespace rappor {
15 namespace {
17 bool MockIsIncognito(bool* is_incognito) {
18 return *is_incognito;
21 } // namespace
23 TestRapporService::TestRapporService()
24 : RapporService(&test_prefs_, base::Bind(&MockIsIncognito, &is_incognito_)),
25 next_rotation_(base::TimeDelta()),
26 is_incognito_(false) {
27 RegisterPrefs(test_prefs_.registry());
28 test_uploader_ = new TestLogUploader();
29 InitializeInternal(make_scoped_ptr(test_uploader_),
31 HmacByteVectorGenerator::GenerateEntropyInput());
32 Update(FINE_LEVEL, true);
35 TestRapporService::~TestRapporService() {}
37 int TestRapporService::GetReportsCount() {
38 RapporReports reports;
39 ExportMetrics(&reports);
40 return reports.report_size();
43 void TestRapporService::GetReports(RapporReports* reports) {
44 ExportMetrics(reports);
47 // Cancel the next call to OnLogInterval.
48 void TestRapporService::CancelNextLogRotation() {
49 next_rotation_ = base::TimeDelta();
52 // Schedule the next call to OnLogInterval.
53 void TestRapporService::ScheduleNextLogRotation(base::TimeDelta interval) {
54 next_rotation_ = interval;
57 } // namespace rappor