Chromium Code Reviews| Index: content/public/test/test_navigation_observer.cc |
| diff --git a/content/public/test/test_navigation_observer.cc b/content/public/test/test_navigation_observer.cc |
| index bfe74f663589ab4719fd6e74a94504f72888fff4..5631f59ee6afcfa65cc5017815698ecbd6e38c6e 100644 |
| --- a/content/public/test/test_navigation_observer.cc |
| +++ b/content/public/test/test_navigation_observer.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/stl_util.h" |
| #include "content/browser/web_contents/web_contents_impl.h" |
| #include "content/public/browser/web_contents_observer.h" |
| +#include "content/public/test/browser_test_utils.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| namespace content { |
| @@ -54,7 +55,8 @@ class TestNavigationObserver::TestWebContentsObserver |
| TestNavigationObserver::TestNavigationObserver( |
| WebContents* web_contents, |
| int number_of_navigations) |
| - : navigation_started_(false), |
| + : web_contents_(web_contents), |
| + navigation_started_(false), |
| navigations_completed_(0), |
| number_of_navigations_(number_of_navigations), |
| message_loop_runner_(new MessageLoopRunner), |
| @@ -68,7 +70,8 @@ TestNavigationObserver::TestNavigationObserver( |
| TestNavigationObserver::TestNavigationObserver( |
| WebContents* web_contents) |
| - : navigation_started_(false), |
| + : web_contents_(web_contents), |
| + navigation_started_(false), |
| navigations_completed_(0), |
| number_of_navigations_(1), |
| message_loop_runner_(new MessageLoopRunner), |
| @@ -89,6 +92,14 @@ TestNavigationObserver::~TestNavigationObserver() { |
| void TestNavigationObserver::Wait() { |
| message_loop_runner_->Run(); |
| + // If this is the very first navigation, the RenderView for WebContents |
| + // will be created as a result. The creation involves sending a resize |
| + // message to the renderer process. Here we wait for the resize ack to be |
| + // received, since tests may not expect to end up in a "waiting for resize" |
| + // state after the first navigation. |
| + // E.g. currently WindowEventDispatcher has code to hold touch and mouse |
| + // move events until resize is complete (crbug.com/384342) |
| + WaitForResizeComplete(web_contents_); |
|
mfomitchev
2014/06/13 15:56:21
I wonder if we should make it so that this is done
|
| } |
| void TestNavigationObserver::StartWatchingNewWebContents() { |