Index: components/page_load_metrics/renderer/fake_page_load_metrics.h |
diff --git a/components/page_load_metrics/renderer/fake_page_timing_metrics_ipc_sender.h b/components/page_load_metrics/renderer/fake_page_load_metrics.h |
similarity index 55% |
rename from components/page_load_metrics/renderer/fake_page_timing_metrics_ipc_sender.h |
rename to components/page_load_metrics/renderer/fake_page_load_metrics.h |
index 44e1e672a7cf5af66e71852ac4565d0d09a3b649..bbeb5c552933aa4201deea6b1cc8974767dbdc65 100644 |
--- a/components/page_load_metrics/renderer/fake_page_timing_metrics_ipc_sender.h |
+++ b/components/page_load_metrics/renderer/fake_page_load_metrics.h |
@@ -2,13 +2,13 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef COMPONENTS_PAGE_LOAD_METRICS_RENDERER_FAKE_PAGE_TIMING_METRICS_IPC_SENDER_H_ |
-#define COMPONENTS_PAGE_LOAD_METRICS_RENDERER_FAKE_PAGE_TIMING_METRICS_IPC_SENDER_H_ |
+#ifndef COMPONENTS_PAGE_LOAD_METRICS_RENDERER_FAKE_PAGE_LOAD_METRICS_H_ |
+#define COMPONENTS_PAGE_LOAD_METRICS_RENDERER_FAKE_PAGE_LOAD_METRICS_H_ |
#include <vector> |
+#include "components/page_load_metrics/common/page_load_metrics.mojom.h" |
#include "components/page_load_metrics/common/page_load_timing.h" |
-#include "ipc/ipc_sender.h" |
namespace IPC { |
class Message; |
@@ -16,17 +16,18 @@ class Message; |
namespace page_load_metrics { |
-// IPC::Sender implementation for use in tests. Allows for setting and verifying |
-// basic expectations when sending PageLoadTiming IPCs. By default, |
-// FakePageTimingMetricsIPCSender will verify that expected and actual |
+// mojom::PageLoadMetrics implementation for use in tests. Allows for setting |
+// and verifying basic expectations when sending PageLoadTiming IPCs. By |
+// default, FakePageLoadMetrics will verify that expected and actual |
// PageLoadTimings match on each invocation to ExpectPageLoadTiming() and |
// Send(), as well as in the destructor. Tests can force additional validations |
// by calling VerifyExpectedTimings. |
// |
// Expected PageLoadTimings are specified via ExpectPageLoadTiming, and actual |
-// PageLoadTimings are dispatched through Send(). When Send() is called, we |
-// verify that the actual PageLoadTimings dipatched through Send() match the |
-// expected PageLoadTimings provided via ExpectPageLoadTiming. |
+// PageLoadTimings are dispatched through TimingUpdated(). When TimingUpdated() |
+// is called, we verify that the actual PageLoadTimings dipatched through |
+// TimingUpdated() match the expected PageLoadTimings provided via |
+// ExpectPageLoadTiming. |
// |
// Normally, gmock would be used in place of this class, but gmock is not |
// compatible with structures that use aligned memory, and PageLoadTiming will |
@@ -34,16 +35,10 @@ namespace page_load_metrics { |
// our own implementation here. See |
// https://groups.google.com/forum/#!topic/googletestframework/W-Hud3j_c6I for |
// more details. |
-class FakePageTimingMetricsIPCSender : public IPC::Sender { |
+class FakePageLoadMetrics : public mojom::PageLoadMetrics { |
public: |
- FakePageTimingMetricsIPCSender(); |
- ~FakePageTimingMetricsIPCSender() override; |
- |
- // Implementation of IPC::Sender. PageLoadMetricsMsg_TimingUpdated IPCs that |
- // send updated PageLoadTimings should be dispatched through this method. This |
- // method will verify that all PageLoadTiming update IPCs dispatched so far |
- // match with the expected PageLoadTimings passed to ExpectPageLoadTiming. |
- bool Send(IPC::Message* message) override; |
+ FakePageLoadMetrics(); |
+ ~FakePageLoadMetrics() override; |
// PageLoadTimings that are expected to be sent through Send() should be |
// passed to ExpectPageLoadTiming. |
@@ -61,7 +56,8 @@ class FakePageTimingMetricsIPCSender : public IPC::Sender { |
} |
private: |
- void OnTimingUpdated(const PageLoadTiming& timing, PageLoadMetadata metadata); |
+ void TimingUpdated(const PageLoadTiming& timing, |
+ const PageLoadMetadata& metadata) override; |
std::vector<PageLoadTiming> expected_timings_; |
std::vector<PageLoadTiming> actual_timings_; |
@@ -69,4 +65,4 @@ class FakePageTimingMetricsIPCSender : public IPC::Sender { |
} // namespace page_load_metrics |
-#endif // COMPONENTS_PAGE_LOAD_METRICS_RENDERER_FAKE_PAGE_TIMING_METRICS_IPC_SENDER_H_ |
+#endif // COMPONENTS_PAGE_LOAD_METRICS_RENDERER_FAKE_PAGE_LOAD_METRICS_H_ |