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

Unified Diff: headless/test/headless_browser_test.cc

Issue 2720543002: Fix headless_browsertests failures with PlzNavigate. (Closed)
Patch Set: without PlzNavigate Created 3 years, 10 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
Index: headless/test/headless_browser_test.cc
diff --git a/headless/test/headless_browser_test.cc b/headless/test/headless_browser_test.cc
index 53e2db2ba0f633d3ab9ab05ec3acbb8a667ef560..61388383a8b780d0a7d2b7cf9d2be08a1350ce62 100644
--- a/headless/test/headless_browser_test.cc
+++ b/headless/test/headless_browser_test.cc
@@ -11,7 +11,9 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/url_constants.h"
+#include "content/public/test/test_navigation_observer.h"
#include "headless/lib/browser/headless_browser_impl.h"
+#include "headless/lib/browser/headless_web_contents_impl.h"
#include "headless/lib/headless_content_main_delegate.h"
#include "headless/public/devtools/domains/runtime.h"
#include "headless/public/headless_devtools_client.h"
@@ -157,9 +159,12 @@ HeadlessBrowser::Options* HeadlessBrowserTest::options() const {
}
bool HeadlessBrowserTest::WaitForLoad(HeadlessWebContents* web_contents) {
- SynchronousLoadObserver load_observer(this, web_contents);
- RunAsynchronousTest();
- return load_observer.navigation_succeeded();
+ HeadlessWebContentsImpl* web_contents_impl =
+ HeadlessWebContentsImpl::From(web_contents);
+ content::TestNavigationObserver observer(web_contents_impl->web_contents(),
Sami 2017/02/27 11:46:19 This part makes me a little nervous: if we can't r
jam 2017/02/27 15:18:18 The main difference with PlzNavigate, due to the b
Sami 2017/02/27 16:22:53 I see, thanks for the explanation. I wonder if the
jam 2017/02/27 16:29:43 I'm not really sure I understand this comment, sor
Sami 2017/02/27 16:36:39 Sorry for being vague: I fully trust this specific
jam 2017/02/27 16:52:57 ah, got it, thanks. An example of this scenario i
jam 2017/02/27 16:53:45 oh, and if course, if all a user of headless cares
Sami 2017/02/27 17:33:02 Alright, thanks for the explanation. The intermedi
+ 1);
+ observer.Wait();
+ return observer.last_navigation_succeeded();
}
std::unique_ptr<runtime::EvaluateResult> HeadlessBrowserTest::EvaluateScript(

Powered by Google App Engine
This is Rietveld 408576698