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

Unified Diff: components/ukm/test_ukm_recorder.h

Issue 2883563002: Refactor UKM interface for mojo-ification (Closed)
Patch Set: Move interface to next CL 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..a0919d26a6934e980fff1bd84852b0b96670b7cc
--- /dev/null
+++ b/components/ukm/test_ukm_recorder.h
@@ -0,0 +1,39 @@
+// 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 "components/ukm/ukm_recorder_impl.h"
+
oystein (OOO til 10th of July) 2017/05/17 18:25:06 Should have #include "base/macros.h" here I think.
Steven Holte 2017/05/17 20:44:31 Done.
+namespace ukm {
+
+// Wraps an UkmRecorder with additional accessors used for testing.
+class TestUkmRecorder : public UkmRecorderImpl {
+ public:
+ explicit TestUkmRecorder();
oystein (OOO til 10th of July) 2017/05/17 18:25:06 nit: No need for explicit here.
Steven Holte 2017/05/17 20:44:31 Done.
+ ~TestUkmRecorder() override;
+
+ size_t sources_count() const { return sources().size(); }
+ const std::map<ukm::SourceId, std::unique_ptr<UkmSource>>& GetSources() const;
oystein (OOO til 10th of July) 2017/05/17 18:25:06 Why isn't this inlined, like the others, if it's b
Steven Holte 2017/05/17 20:44:31 inlined
+ 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