Fixed Test to handle mouse interaction on InProcess Iframes.

The Captured Sites Automation Framework has trouble handling mouse
interactions on in-process, cross-origin iframes.

An in-process cross domain iframe is an iframe that has a different domain as its parent frame, yet shares the same rendering process as the parent frame. Such an iframe has 2 interesting properties:

1. The InProcessBrowserTest Framework needs to know the iframe's position relative to its top-most in-process ancestor frame. The framework simulates mouse clicks by forwarding mouse event to a frame's RenderWidgetHost, but RenderWidgetHost references the top -most in-process frame's viewport. A mouse coordinate inside a child iframe is therefore
mouse coordinate inside child iframe + iframe position relative to ancestor
2. The iframe cannot access the parent frame's document, since cross-domain protection blocks the iframe document from accessing the parent frame document.

Recently I found a reliable way to construct a path from an iframe to
its top-most in-process ancestor frame in a Chrome Extension. A path is
a list of iframe element xpaths. At each node in the path, we can

1. Switch to each parent frame's RenderFrameHost.
2. Run JavaScript with the iframe xpath to locate the iframe element.
3. Run JavaScript GetBoundingClientRect function to get the iframe
element's offset.

Then, summing the offset of all the iframes along the path gives us the
offset of the target iframe in the frame's rendering process.

This change implements this fix.

This change also removes a previously ineffective workaround. The work
around uses a hard-coded offset value for iframes. This strategy is
ineffective because the offset changes after any scrolling action. The
test framework uses scroll to position an element in the center of the
page before simulating mouse interaction.

Bug: 847905
Change-Id: Ic61b9c5e8719aa471a32f350c7eb0ce6a0b38459
Reviewed-on: https://chromium-review.googlesource.com/c/1418079
Reviewed-by: Sebastien Seguin-Gagnon <sebsg@chromium.org>
Commit-Queue: Sebastien Seguin-Gagnon <sebsg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#623829}
3 files changed