Index: chrome/renderer/page_load_metrics/fake_page_timing_sender.h |
diff --git a/chrome/renderer/page_load_metrics/fake_page_timing_sender.h b/chrome/renderer/page_load_metrics/fake_page_timing_sender.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..08d1175592c6ade7d5ed624b1cee8d69197be10f |
--- /dev/null |
+++ b/chrome/renderer/page_load_metrics/fake_page_timing_sender.h |
@@ -0,0 +1,37 @@ |
+// Copyright (c) 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 CHROME_RENDERER_PAGE_LOAD_METRICS_FAKE_PAGE_TIMING_SENDER_H_ |
+#define CHROME_RENDERER_PAGE_LOAD_METRICS_FAKE_PAGE_TIMING_SENDER_H_ |
+ |
+#include "chrome/common/page_load_metrics/page_load_metrics.mojom.h" |
+#include "chrome/common/page_load_metrics/page_load_timing.h" |
+#include "chrome/renderer/page_load_metrics/page_timing_sender.h" |
+ |
+namespace page_load_metrics { |
+ |
+// PageTimingSender fake implementation for use in tests. Allows to implement |
+// customized Send() in order to send mojo to specific mojom::PageLoadMetrics |
+// for tests. |
+// It does not verify any message it sends. |
+// The pointer to mojom::PageLoadMetrics implementation must be set before |
+// calling SendTiming. |
+class FakePageTimingSender : public PageTimingSender { |
+ public: |
+ FakePageTimingSender(); |
+ ~FakePageTimingSender(); |
+ void SendTiming(const PageLoadTiming& timing, |
+ const PageLoadMetadata& metadata) override; |
+ mojom::PageLoadMetricsPtr& page_load_metrics_ptr() { |
+ return page_load_metrics_ptr_; |
+ } |
+ |
+ private: |
+ mojom::PageLoadMetricsPtr page_load_metrics_ptr_; |
+ DISALLOW_COPY_AND_ASSIGN(FakePageTimingSender); |
+}; |
+ |
+} // namespace page_load_metrics |
+ |
+#endif // CHROME_RENDERER_PAGE_LOAD_METRICS_FAKE_PAGE_TIMING_SENDER_H_ |