| 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 15 matching lines...) Expand all Loading... |
| 26 TestSample(RapporType type); | 26 TestSample(RapporType type); |
| 27 ~TestSample() override; | 27 ~TestSample() override; |
| 28 | 28 |
| 29 // Sample: | 29 // Sample: |
| 30 void SetStringField(const std::string& field_name, | 30 void SetStringField(const std::string& field_name, |
| 31 const std::string& value) override; | 31 const std::string& value) override; |
| 32 void SetFlagsField(const std::string& field_name, | 32 void SetFlagsField(const std::string& field_name, |
| 33 uint64_t flags, | 33 uint64_t flags, |
| 34 size_t num_flags) override; | 34 size_t num_flags) override; |
| 35 | 35 |
| 36 void SetUInt64Field(const std::string& field_name, |
| 37 uint64_t value, |
| 38 NoiseLevel noise_level) override; |
| 39 |
| 36 struct Shadow { | 40 struct Shadow { |
| 37 explicit Shadow(RapporType type); | 41 explicit Shadow(RapporType type); |
| 38 Shadow(const Shadow& other); | 42 Shadow(const Shadow& other); |
| 39 ~Shadow(); | 43 ~Shadow(); |
| 40 RapporType type; | 44 RapporType type; |
| 41 std::map<std::string, uint64_t> flag_fields; | 45 std::map<std::string, uint64_t> flag_fields; |
| 42 std::map<std::string, std::string> string_fields; | 46 std::map<std::string, std::string> string_fields; |
| 47 std::map<std::string, std::pair<std::uint64_t, NoiseLevel>> uint64_fields; |
| 43 }; | 48 }; |
| 44 | 49 |
| 45 Shadow GetShadow() { return shadow_; } | 50 Shadow GetShadow() { return shadow_; } |
| 46 | 51 |
| 47 private: | 52 private: |
| 48 Shadow shadow_; | 53 Shadow shadow_; |
| 49 }; | 54 }; |
| 50 | 55 |
| 51 // This class provides a simple instance that can be instantiated by tests | 56 // 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 | 57 // and examined to check that metrics were recorded. It assumes the most |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 133 |
| 129 // Sets this to true to mock incognito state. | 134 // Sets this to true to mock incognito state. |
| 130 bool is_incognito_; | 135 bool is_incognito_; |
| 131 | 136 |
| 132 DISALLOW_COPY_AND_ASSIGN(TestRapporServiceImpl); | 137 DISALLOW_COPY_AND_ASSIGN(TestRapporServiceImpl); |
| 133 }; | 138 }; |
| 134 | 139 |
| 135 } // namespace rappor | 140 } // namespace rappor |
| 136 | 141 |
| 137 #endif // COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_ | 142 #endif // COMPONENTS_RAPPOR_TEST_RAPPOR_SERVICE_H_ |
| OLD | NEW |