Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8951)

Unified Diff: components/ukm/test_ukm_recorder.h

Issue 2883563002: Refactor UKM interface for mojo-ification (Closed)
Patch Set: Fix uma_session_stats.cc Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/ukm/test_ukm_recorder.h
diff --git a/components/ukm/test_ukm_recorder.h b/components/ukm/test_ukm_recorder.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd6c49b44f6600f0eba5ded8a5f64007e611aa8a
--- /dev/null
+++ b/components/ukm/test_ukm_recorder.h
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_UKM_TEST_UKM_SERVICE_H_
+#define COMPONENTS_UKM_TEST_UKM_SERVICE_H_
+
+#include <stddef.h>
+#include <memory>
+
+#include "base/macros.h"
+#include "components/ukm/ukm_recorder_impl.h"
+
+namespace ukm {
+
+// Wraps an UkmRecorder with additional accessors used for testing.
+class TestUkmRecorder : public UkmRecorderImpl {
+ public:
+ TestUkmRecorder();
+ ~TestUkmRecorder() override;
+
+ size_t sources_count() const { return sources().size(); }
+ const std::map<ukm::SourceId, std::unique_ptr<UkmSource>>& GetSources()
+ const {
+ return sources();
+ }
+ const UkmSource* GetSourceForUrl(const char* url) const;
+ const UkmSource* GetSourceForSourceId(ukm::SourceId source_id) const;
+
+ size_t entries_count() const { return entries().size(); }
+ const mojom::UkmEntry* GetEntry(size_t entry_num) const;
+ const mojom::UkmEntry* GetEntryForEntryName(const char* entry_name) const;
+
+ static const mojom::UkmMetric* FindMetric(const mojom::UkmEntry* entry,
+ const char* metric_name);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestUkmRecorder);
+};
+
+} // namespace ukm
+
+#endif // COMPONENTS_UKM_TEST_UKM_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698