| 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..458c9dcdef037c8186c614b4ac5f4c35be6531ef 100644
|
| --- a/content/public/test/test_navigation_observer.cc
|
| +++ b/content/public/test/test_navigation_observer.cc
|
| @@ -46,6 +46,10 @@ class TestNavigationObserver::TestWebContentsObserver
|
| parent_->OnDidStopLoading(web_contents());
|
| }
|
|
|
| + virtual void DidFirstVisuallyNonEmptyPaint() OVERRIDE {
|
| + parent_->OnDidFirstVisuallyNonEmptyPaint(web_contents());
|
| + }
|
| +
|
| TestNavigationObserver* parent_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver);
|
| @@ -53,10 +57,28 @@ class TestNavigationObserver::TestWebContentsObserver
|
|
|
| TestNavigationObserver::TestNavigationObserver(
|
| WebContents* web_contents,
|
| + int number_of_navigations,
|
| + FirstPaint first_paint)
|
| + : navigation_started_(false),
|
| + navigations_completed_(0),
|
| + number_of_navigations_(number_of_navigations),
|
| + first_paint_(first_paint),
|
| + message_loop_runner_(new MessageLoopRunner),
|
| + web_contents_created_callback_(
|
| + base::Bind(
|
| + &TestNavigationObserver::OnWebContentsCreated,
|
| + base::Unretained(this))) {
|
| + if (web_contents)
|
| + RegisterAsObserver(web_contents);
|
| +}
|
| +
|
| +TestNavigationObserver::TestNavigationObserver(
|
| + WebContents* web_contents,
|
| int number_of_navigations)
|
| : navigation_started_(false),
|
| navigations_completed_(0),
|
| number_of_navigations_(number_of_navigations),
|
| + first_paint_(FirstPaintNotRequired),
|
| message_loop_runner_(new MessageLoopRunner),
|
| web_contents_created_callback_(
|
| base::Bind(
|
| @@ -71,6 +93,7 @@ TestNavigationObserver::TestNavigationObserver(
|
| : navigation_started_(false),
|
| navigations_completed_(0),
|
| number_of_navigations_(1),
|
| + first_paint_(FirstPaintNotRequired),
|
| message_loop_runner_(new MessageLoopRunner),
|
| web_contents_created_callback_(
|
| base::Bind(
|
| @@ -138,7 +161,20 @@ void TestNavigationObserver::OnDidStopLoading(WebContents* web_contents) {
|
| return;
|
|
|
| ++navigations_completed_;
|
| - if (navigations_completed_ == number_of_navigations_) {
|
| + if ((navigations_completed_ == number_of_navigations_) &&
|
| + first_paint_ == FirstPaintNotRequired) {
|
| + navigation_started_ = false;
|
| + message_loop_runner_->Quit();
|
| + }
|
| +}
|
| +
|
| +void TestNavigationObserver::OnDidFirstVisuallyNonEmptyPaint(
|
| + WebContents* web_contents) {
|
| + if (!navigation_started_)
|
| + return;
|
| +
|
| + if ((navigations_completed_ == number_of_navigations_) &&
|
| + first_paint_ == FirstPaintRequired) {
|
| navigation_started_ = false;
|
| message_loop_runner_->Quit();
|
| }
|
|
|