Don't schedule more invokeFunctors than necessary.
[chromium-blink-merge.git] / components / rappor / test_rappor_service.h
blob6772e90956d3a37f9a90159ef4a7de6d1e075468
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"
11 namespace rappor {
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 {
17 public:
18 TestRapporService();
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();
28 private:
29 TestingPrefServiceSimple prefs_;
31 DISALLOW_COPY_AND_ASSIGN(TestRapporService);
34 } // namespace rappor
36 #endif // COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_