OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #ifndef COMPONENTS_UKM_TEST_UKM_SERVICE_H_ |
| 6 #define COMPONENTS_UKM_TEST_UKM_SERVICE_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 #include <memory> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "components/ukm/ukm_recorder_impl.h" |
| 13 |
| 14 namespace ukm { |
| 15 |
| 16 // Wraps an UkmRecorder with additional accessors used for testing. |
| 17 class TestUkmRecorder : public UkmRecorderImpl { |
| 18 public: |
| 19 TestUkmRecorder(); |
| 20 ~TestUkmRecorder() override; |
| 21 |
| 22 size_t sources_count() const { return sources().size(); } |
| 23 const std::map<ukm::SourceId, std::unique_ptr<UkmSource>>& GetSources() |
| 24 const { |
| 25 return sources(); |
| 26 } |
| 27 const UkmSource* GetSourceForUrl(const char* url) const; |
| 28 const UkmSource* GetSourceForSourceId(ukm::SourceId source_id) const; |
| 29 |
| 30 size_t entries_count() const { return entries().size(); } |
| 31 const mojom::UkmEntry* GetEntry(size_t entry_num) const; |
| 32 const mojom::UkmEntry* GetEntryForEntryName(const char* entry_name) const; |
| 33 |
| 34 static const mojom::UkmMetric* FindMetric(const mojom::UkmEntry* entry, |
| 35 const char* metric_name); |
| 36 |
| 37 private: |
| 38 DISALLOW_COPY_AND_ASSIGN(TestUkmRecorder); |
| 39 }; |
| 40 |
| 41 } // namespace ukm |
| 42 |
| 43 #endif // COMPONENTS_UKM_TEST_UKM_SERVICE_H_ |
OLD | NEW |