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

Unified Diff: content/test/test_render_frame_host.cc

Issue 2157153003: Call WillStartRequestForTesting in TestRenderFrameHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just null check nav handle Created 4 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/test/test_render_frame_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e6284f3fb6bfcea4cd15dba70c32256e5db34d62..896d87b150951eb306a772f7e28a028e6a1a63b5 100644
--- a/content/test/test_render_frame_host.cc
+++ b/content/test/test_render_frame_host.cc
@@ -14,6 +14,7 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/frame_messages.h"
#include "content/common/frame_owner_properties.h"
+#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/stream_handle.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/url_constants.h"
@@ -106,6 +107,7 @@ void TestRenderFrameHost::SimulateNavigationStart(const GURL& url) {
OnDidStartLoading(true);
OnDidStartProvisionalLoad(url, base::TimeTicks::Now());
+ SimulateWillStartRequest(ui::PAGE_TRANSITION_LINK);
}
void TestRenderFrameHost::SimulateRedirect(const GURL& new_url) {
@@ -290,6 +292,7 @@ void TestRenderFrameHost::SendNavigateWithParameters(
// so we keep a copy of it to use below.
GURL url_copy(url);
OnDidStartProvisionalLoad(url_copy, base::TimeTicks::Now());
+ SimulateWillStartRequest(transition);
FrameHostMsg_DidCommitProvisionalLoad_Params params;
params.page_id = page_id;
@@ -440,4 +443,13 @@ int32_t TestRenderFrameHost::ComputeNextPageID() {
return page_id;
}
+void TestRenderFrameHost::SimulateWillStartRequest(
+ ui::PageTransition transition) {
+ if (!navigation_handle())
+ return;
+ navigation_handle()->CallWillStartRequestForTesting(
+ false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault),
+ true /* user_gesture */, transition, false /* is_external_protocol */);
+}
+
} // namespace content
« no previous file with comments | « content/test/test_render_frame_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698