OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_ | 5 #ifndef COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_ |
6 #define COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_ | 6 #define COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // This class provides a simple instance that can be instantiated by tests | 51 // This class provides a simple instance that can be instantiated by tests |
52 // and examined to check that metrics were recorded. It assumes the most | 52 // and examined to check that metrics were recorded. It assumes the most |
53 // permissive settings so that any metric can be recorded. | 53 // permissive settings so that any metric can be recorded. |
54 class TestRapporService : public RapporService { | 54 class TestRapporService : public RapporService { |
55 public: | 55 public: |
56 TestRapporService(); | 56 TestRapporService(); |
57 | 57 |
58 ~TestRapporService() override; | 58 ~TestRapporService() override; |
59 | 59 |
60 // RapporService: | 60 // RapporService: |
61 scoped_ptr<Sample> CreateSample(RapporType type) override; | 61 std::unique_ptr<Sample> CreateSample(RapporType type) override; |
62 void RecordSampleObj(const std::string& metric_name, | 62 void RecordSampleObj(const std::string& metric_name, |
63 scoped_ptr<Sample> sample) override; | 63 std::unique_ptr<Sample> sample) override; |
64 void RecordSample(const std::string& metric_name, | 64 void RecordSample(const std::string& metric_name, |
65 RapporType type, | 65 RapporType type, |
66 const std::string& sample) override; | 66 const std::string& sample) override; |
67 | 67 |
68 // Gets the number of reports that would be uploaded by this service. | 68 // Gets the number of reports that would be uploaded by this service. |
69 // This also clears the internal map of metrics as a biproduct, so if | 69 // This also clears the internal map of metrics as a biproduct, so if |
70 // comparing numbers of reports, the comparison should be from the last time | 70 // comparing numbers of reports, the comparison should be from the last time |
71 // GetReportsCount() was called (not from the beginning of the test). | 71 // GetReportsCount() was called (not from the beginning of the test). |
72 int GetReportsCount(); | 72 int GetReportsCount(); |
73 | 73 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 // Sets this to true to mock incognito state. | 129 // Sets this to true to mock incognito state. |
130 bool is_incognito_; | 130 bool is_incognito_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(TestRapporService); | 132 DISALLOW_COPY_AND_ASSIGN(TestRapporService); |
133 }; | 133 }; |
134 | 134 |
135 } // namespace rappor | 135 } // namespace rappor |
136 | 136 |
137 #endif // COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_ | 137 #endif // COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_ |
OLD | NEW |