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 #ifndef COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_
6 #define COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_
8 #include "base/prefs/testing_pref_service.h"
9 #include "components/rappor/rappor_service.h"
13 // This class provides a simple instance that can be instantiated by tests
14 // and examined to check that metrics were recorded. It assumes the most
15 // permissive settings so that any metric can be recorded.
16 class TestRapporService
: public RapporService
{
20 ~TestRapporService() override
;
22 // Get the number of reports that would be uploaded by this service.
23 // This also clears the internal map of metrics as a biproduct, so if
24 // comparing numbers of reports, the comparison should be from the last time
25 // GetReportsCount() was called (not from the beginning of the test).
26 int GetReportsCount();
29 TestingPrefServiceSimple prefs_
;
31 DISALLOW_COPY_AND_ASSIGN(TestRapporService
);
36 #endif // COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_