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

Unified Diff: chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc

Issue 2823523003: [Page Load Metrics] PageLoadMetrics Mojofication. (Closed)
Patch Set: Addressed comments, remove unnecessary RunUntilIdle, call OnTimingUpdated directly in unit tests Created 3 years, 8 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: chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc
diff --git a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc
index 2a0e0313ad875123910fff5c1be73b19b1e3be14..bac746efc627dae9fa2d0772d739994bbaa66a38 100644
--- a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc
+++ b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc
@@ -9,8 +9,10 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
+#include "base/run_loop.h"
#include "chrome/browser/page_load_metrics/page_load_metrics_embedder_interface.h"
#include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
+#include "chrome/common/page_load_metrics/page_load_metrics.mojom.h"
#include "chrome/common/page_load_metrics/page_load_metrics_messages.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h"
#include "content/public/browser/navigation_entry.h"
@@ -147,6 +149,14 @@ void PageLoadMetricsObserverTestHarness::SimulateTimingAndMetadataUpdate(
observer_->OnMessageReceived(PageLoadMetricsMsg_TimingUpdated(
Bryan McQuade 2017/04/26 16:04:34 let's switch this to invoke OnTimingUpdated direct
lpy 2017/04/27 10:58:35 Done. Forgot to change this part
observer_->routing_id(), timing, metadata),
web_contents()->GetMainFrame());
+ observer_->page_load_metrics_binding_for_testing()
+ .SetCurrentTargetFrameForTesting(web_contents()->GetMainFrame());
+ mojo::Binding<page_load_metrics::mojom::PageLoadMetrics> binding(observer_);
+ mojom::PageLoadMetricsPtr ptr;
+ mojom::PageLoadMetricsRequest request = MakeRequest(&ptr);
+ binding.Bind(std::move(request));
+ ptr->UpdateTiming(timing, metadata);
+ base::RunLoop().RunUntilIdle();
}
void PageLoadMetricsObserverTestHarness::SimulateStartedResource(

Powered by Google App Engine
This is Rietveld 408576698