Improve mac webtest size injection timing

This changes the hook-up of mac web tests to resize the top level
RenderWidgetHostView as soon as the renderer-side objects are created
so that the correct screen rects can be sent to the renderer. Previously
it was hooked up to the asynchronous RenderViewReady() which made it
race with the renderer running the test, a race it happened to win. Now
we do it when
a) The main RenderFrame is created (along with its renderer-side widget)
b) A new window/webcontents is created, and it already has a renderer-
   side main frame when it is wrapped in a Shell.

This will allow us to change the browser-side code notifying about
renderer objects being created without breaking these tests in
https://chromium-review.googlesource.com/c/chromium/src/+/2597851 .

[email protected]

Bug: 1158869
Change-Id: I645d67c705a9390853c052804edbd07eaea91c95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2606520
Auto-Submit: danakj <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Commit-Queue: danakj <[email protected]>
Cr-Commit-Position: refs/heads/master@{#839784}
diff --git a/content/shell/browser/shell_platform_delegate.h b/content/shell/browser/shell_platform_delegate.h
index 3c831b856..7d5e31bb 100644
--- a/content/shell/browser/shell_platform_delegate.h
+++ b/content/shell/browser/shell_platform_delegate.h
@@ -68,9 +68,10 @@
   // Set the title of shell window
   virtual void SetTitle(Shell* shell, const base::string16& title);
 
-  // Called when a RenderView is created for a renderer process; forwarded from
-  // WebContentsObserver.
-  virtual void RenderViewReady(Shell* shell);
+  // Called when the main frame is created in the renderer process; forwarded
+  // from WebContentsObserver. If navigation creates a new main frame, this may
+  // occur more than once.
+  virtual void MainFrameCreated(Shell* shell);
 
   // Allows platforms to override the JavascriptDialogManager. By default
   // returns null, which signals that the Shell should use its own instance.