Fix (frame-based) MimeHandlerViewGuest Attaching

The CL 1187231 implemented MimeHandlerViewFrameContainer. This is a
follow-up to that CL to fix some major issues in attaching a MHVG on
the browser side.

The main problems and updates:
  1- The test added in 1187231 was inadvertently removed in Patch 4.
     This caused the incorrect code to land without flagging. This CL
     adds the test again (test runs with
     MimeHandlerViewInCrossProcessFrame).
  2- MimeHandlerViewGuest::WillBeginAttach was using
     |embedder_web_contents()| which is null at this point.
  3- The newly introduced code path for attaching Guests on the browser
     side would end up in code paths which expected RWHVGuest. This was
     happening in BPG::OnWillAttachComplete leading to an invalid cast
     from RWHVCF to RWHVG. This turned out to cause crashes on some
     bots.
  4- It is possible with small changes to unify the attaching code path
     for other GuestViews and MHVG. This CL does just that.

This CL also adds a sanity DCHECK in WCViewGuest to make sure we do not
instantiate an incorrect type of GuestView.

Bug: 659750
Change-Id: Id9c668aa5a98a8f669f56596828cef40198ec57f
Reviewed-on: https://chromium-review.googlesource.com/1225307
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: James MacLean <wjmaclean@chromium.org>
Reviewed-by: Ehsan Karamad <ekaramad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592537}
13 files changed