Changed how CompositedScrollingBrowserTest waits for the URL to finish loading.

Replaced MainThreadFrameObserver with HitTestRegionObserver on LoadURL method.
The test used MainThreadFrameObserver class to wait for the test page
to load before interacting with it.
A more appropriate class to use is the new HitTestRegionObserver to directly wait
for the hit test data.

Test=CompositedScrollingBrowserTest*

Bug: 862683
Change-Id: Iab243a5c27c32d8daed9b922f61ed61498be0ce2
Reviewed-on: https://chromium-review.googlesource.com/c/1412373
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Edwin Joe <ejoe@google.com>
Cr-Commit-Position: refs/heads/master@{#622942}
diff --git a/content/browser/renderer_host/input/composited_scrolling_browsertest.cc b/content/browser/renderer_host/input/composited_scrolling_browsertest.cc
index 15c6751..8a5c0bd 100644
--- a/content/browser/renderer_host/input/composited_scrolling_browsertest.cc
+++ b/content/browser/renderer_host/input/composited_scrolling_browsertest.cc
@@ -21,6 +21,7 @@
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/content_browser_test.h"
 #include "content/public/test/content_browser_test_utils.h"
+#include "content/public/test/hit_test_region_observer.h"
 #include "content/public/test/test_utils.h"
 #include "content/shell/browser/shell.h"
 #include "ui/gfx/geometry/angle_conversions.h"
@@ -83,18 +84,16 @@
     NavigateToURL(shell(), data_url);
 
     RenderWidgetHostImpl* host = GetWidgetHost();
-    MainThreadFrameObserver observer(host);
+    HitTestRegionObserver observer(GetWidgetHost()->GetFrameSinkId());
     host->GetView()->SetSize(gfx::Size(400, 400));
 
     base::string16 ready_title(base::ASCIIToUTF16("ready"));
     TitleWatcher watcher(shell()->web_contents(), ready_title);
     ignore_result(watcher.WaitAndGetTitle());
 
-    // We need to wait until at least one frame has been composited
-    // otherwise the injection of the synthetic gestures may get
-    // dropped because of MainThread/Impl thread sync of touch event
-    // regions.
-    observer.Wait();
+    // Wait for the hit test data to be ready after initiating URL loading
+    // before returning
+    observer.WaitForHitTestData();
   }
 
   // ContentBrowserTest: