Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Unified Diff: content/public/test/test_navigation_observer.cc

Issue 436603002: Enable Screen Orientation integration tests for Chrome OS and Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@reduce_flakiness
Patch Set: fix android Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/test_navigation_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « content/public/test/test_navigation_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698