Thanks again for taking this change on! A few more comments / questions.
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/chrome_content_browser_manifest_overlay.jsonFile chrome/browser/chrome_content_browser_manifest_overlay.json
(right):
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/chrome_content_browser_manifest_overlay.json#newcode34chrome/browser/chrome_content_browser_manifest_overlay.json:34:
"navigation:frame": {
so i can better understand & review the code, can you explain why we're
under 'navigation:frame'? What does that mean & why does page load
metrics belong underneath it?
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/metrics_web_contents_observer.hFile chrome/browser/page_load_metrics/metrics_web_contents_observer.h
(right):
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/metrics_web_contents_observer.h#newcode114chrome/browser/page_load_metrics/metrics_web_contents_observer.h:114:
friend class FakePageLoadMetrics;
i'm a bit uncomfortable about this - i need to see why the helper
browser test class needs access to private state, but i'd like to try to
avoid this need if at all possible.
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.ccFile
chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc
(right):
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc#newcode176chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc:176:
observer_->page_load_metrics_binding_for_testing()
I think I'm inclined to change the SimulateTimingUpdate impl to just
directly invoke OnTimingUpdated, rather than going through the IPC
dispatch patch, and not having to have the test invoke / know about both
IPC and Mojo. This is a unit test so it shouldn't really have to know
about IPC or Mojo dispatch. While it's nice to exercise slightly more
code with IPC dispatch, it adds the complexity of now also having to
invoke the mojo path here, having to expose the
page_load_metrics_binding_for_testing() method on the observer, and we
do also have the browsertest for IPC/Mojo dispatch coverage so I feel it
is a little redundant to also do that here, given the complexity it now
adds.
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.ccFile
chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc
(right):
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc#newcode148chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc:148:
observer_->OnMessageReceived(PageLoadMetricsMsg_TimingUpdated(
same thing here - let's invoke OnTimingUpdated directly and avoid the
need to know about mojo in these unit tests.
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.ccFile
chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.cc
(right):
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.cc#newcode1chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.cc:1:
// Copyright 2015 The Chromium Authors. All rights reserved.
on first glance i'd really like to see if we can have a single
browsertest file for both mojo and ipc flows, rather than 2 separate.
with them split, we have to fix bugs in both places, add new tests in
both places, etc. ideally the duplication goes away soonish but it's
best not to have the duplication at all if possible. i'll spend some
more time thinking about this & see what we can do here.
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.cc#newcode137chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.cc:137:
base::RunLoop().RunUntilIdle();
can we add a comment to explain why this is needed? i usually like to
add a comment explaining why calls to RunUntilIdle() are needed, since
it can often be subtle & helps future modifiers of the code to
understand the specific reason.
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.cc#newcode173chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.cc:173:
metrics_observer_->page_load_metrics_binding_for_testing()
it seems odd that we need to wire this frame mapping up in a browser
test. a browser test should be managing the message routing between
frames correctly on its own. why is this needed?
https://codereview.chromium.org/2823523003/diff/180001/chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.cc#newcode179chrome/browser/page_load_metrics/page_load_metrics_mojofication_browsertest.cc:179:
void AddObserver(PageLoadTimingObserver* observer) {
hmm, this doesn't seem like it should be here. i'm concerned that we're
having to fake out so much behavior here. browser tests are supposed to
exercise the real production codepath. by stubbing this out we're
mitigating much of the value of the browser test. can we spend some time
to see how to get the browser test working w/o the need for a
FakePageLoadMetrics object?