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

Unified Diff: content/test/test_render_frame_host.cc

Issue 2574953002: Fix Android unit_tests failures with PlzNavigate. (Closed)
Patch Set: fix last test and cleanup Created 4 years 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: content/test/test_render_frame_host.cc
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc
index 4d7efdfb471f44bff4cf4b83ba83ae695d925f88..b9f340a5fe1e3a3e08a5d23dcc795bcd5c49ac85 100644
--- a/content/test/test_render_frame_host.cc
+++ b/content/test/test_render_frame_host.cc
@@ -5,6 +5,7 @@
#include "content/test/test_render_frame_host.h"
#include "base/guid.h"
+#include "base/run_loop.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/browser/frame_host/navigation_request.h"
@@ -117,6 +118,12 @@ void TestRenderFrameHost::SimulateNavigationStart(const GURL& url) {
void TestRenderFrameHost::SimulateRedirect(const GURL& new_url) {
if (IsBrowserSideNavigationEnabled()) {
NavigationRequest* request = frame_tree_node_->navigation_request();
+ if (!request->loader_for_testing()) {
+ base::RunLoop loop;
+ request->set_on_start_checks_complete_closure_for_testing(
+ loop.QuitClosure());
+ loop.Run();
+ }
TestNavigationURLLoader* url_loader =
static_cast<TestNavigationURLLoader*>(request->loader_for_testing());
CHECK(url_loader);
@@ -183,6 +190,12 @@ void TestRenderFrameHost::SimulateNavigationError(const GURL& url,
static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host())
->SendBeforeUnloadACK(true);
}
+ if (!request->loader_for_testing()) {
+ base::RunLoop loop;
+ request->set_on_start_checks_complete_closure_for_testing(
+ loop.QuitClosure());
+ loop.Run();
+ }
TestNavigationURLLoader* url_loader =
static_cast<TestNavigationURLLoader*>(request->loader_for_testing());
CHECK(url_loader);
@@ -447,6 +460,13 @@ void TestRenderFrameHost::PrepareForCommitWithServerRedirect(
CHECK(request->state() == NavigationRequest::STARTED);
+ if (!request->loader_for_testing()) {
+ base::RunLoop loop;
+ request->set_on_start_checks_complete_closure_for_testing(
+ loop.QuitClosure());
+ loop.Run();
+ }
+
TestNavigationURLLoader* url_loader =
static_cast<TestNavigationURLLoader*>(request->loader_for_testing());
CHECK(url_loader);

Powered by Google App Engine
This is Rietveld 408576698