Upload upstream chromium 71.0.3578.0
[platform/framework/web/chromium-efl.git] / components / ukm / test_ukm_recorder.h
index 7db123e..c79206c 100644 (file)
@@ -31,11 +31,14 @@ class TestUkmRecorder : public UkmRecorderImpl {
   bool ShouldRestrictToWhitelistedSourceIds() const override;
   bool ShouldRestrictToWhitelistedEntries() const override;
 
+  void AddEntry(mojom::UkmEntryPtr entry) override;
+
   size_t sources_count() const { return sources().size(); }
 
   size_t entries_count() const { return entries().size(); }
 
   using UkmRecorderImpl::UpdateSourceURL;
+  using UkmRecorderImpl::RecordOtherURL;
 
   // Gets all recorded UkmSource data.
   const std::map<ukm::SourceId, std::unique_ptr<UkmSource>>& GetSources()
@@ -46,6 +49,10 @@ class TestUkmRecorder : public UkmRecorderImpl {
   // Gets UkmSource data for a single SourceId.
   const UkmSource* GetSourceForSourceId(ukm::SourceId source_id) const;
 
+  // Sets a callback that will be called when recording an entry for entry name.
+  void SetOnAddEntryCallback(base::StringPiece entry_name,
+                             base::OnceClosure on_add_entry);
+
   // Gets all of the entries recorded for entry name.
   std::vector<const mojom::UkmEntry*> GetEntriesByName(
       base::StringPiece entry_name) const;
@@ -74,6 +81,9 @@ class TestUkmRecorder : public UkmRecorderImpl {
                                        base::StringPiece metric_name);
 
  private:
+  uint64_t entry_hash_to_wait_for_ = 0;
+  base::OnceClosure on_add_entry_;
+
   DISALLOW_COPY_AND_ASSIGN(TestUkmRecorder);
 };