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

Unified Diff: headless/test/headless_browser_test.cc

Issue 2720543002: Fix headless_browsertests failures with PlzNavigate. (Closed)
Patch Set: review comments 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
« no previous file with comments | « headless/lib/headless_devtools_client_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(),
+ 1);
+ observer.Wait();
+ return observer.last_navigation_succeeded();
}
std::unique_ptr<runtime::EvaluateResult> HeadlessBrowserTest::EvaluateScript(
« no previous file with comments | « headless/lib/headless_devtools_client_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698