Update two scroll tests.

This updates the following tests:
- NavigationControllerBrowserTest.ReloadWithUrlAnchor
- NavigationControllerBrowserTest.ReloadWithUrlAnchorAndScroll

This two tests are making a <div> to scroll because of a navigation to
an anchor. Then the tests check the scroll position is restored after a
reload.

The issue is that it is not deterministic when the scrolled area is not
the root area. It is working consistently only because the main
resource's response is small (e.g <64ko) and
FrameLoader::ProcessFragment() is called before
FrameLoader::RestoreScrollPositionAndViewState().

This CL make the tests uses the root area instead of the <div>.

  ---

Description of what happens in the current code:

1) When ProcessFragment() is called first:

  a) ProcessFragment():
  Several scrollable layers are scrolled such that the anchor is
  displayed. It may includes the root one, but also some children.

  b) RestoreScrollPositionAndViewState():
  The root layer is scrolled using what is stored in the HistoryItem. It
  overrides the scroll done in a) for the root layer. Children layers
  are not overridden.

2) When RestoreScrollPositionAndViewState() is called first:

  a) RestoreScrollPositionAndViewState():
  The root layer is scrolled using what is stored in the HistoryItem.
  Children layers are not scrolled.

  b) ProcessFragment():
  Nothing happens because InitialScrollState::did_restore_from_history
  has been set to true in a). The ProcessFragment() will skip the
  fragment scroll.

At the end, the difference is that the children layers are scrolled in
1), but not in 2).

  ---

Bug: 821877, 831155, 839292
Change-Id: I11c74224ba42ad58814c4d4e185d7db189551775
Reviewed-on: https://chromium-review.googlesource.com/1039827
Reviewed-by: Jianpeng Chao <chaopeng@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555727}
2 files changed