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

Unified Diff: content/browser/frame_host/navigation_handle_impl_unittest.cc

Issue 2161073002: Adds RequestContextType information to the NavigationHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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
Index: content/browser/frame_host/navigation_handle_impl_unittest.cc
diff --git a/content/browser/frame_host/navigation_handle_impl_unittest.cc b/content/browser/frame_host/navigation_handle_impl_unittest.cc
index f77bbdf01231f5eb8670ab5feaa8082e13b736d9..29dc039f678bbf9882cd617b273ae24231da773e 100644
--- a/content/browser/frame_host/navigation_handle_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_handle_impl_unittest.cc
@@ -5,6 +5,7 @@
#include "base/macros.h"
#include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/public/browser/navigation_throttle.h"
+#include "content/public/common/request_context_type.h"
#include "content/test/test_render_frame_host.h"
namespace content {
@@ -67,6 +68,8 @@ class NavigationHandleImplTest : public RenderViewHostImplTestHarness {
test_handle_ = NavigationHandleImpl::Create(
GURL(), main_test_rfh()->frame_tree_node(), true, false, false,
base::TimeTicks::Now(), 0);
+ EXPECT_EQ(REQUEST_CONTEXT_TYPE_UNSPECIFIED,
+ test_handle_->request_context_type_);
}
void TearDown() override {
@@ -103,6 +106,7 @@ class NavigationHandleImplTest : public RenderViewHostImplTestHarness {
// the NavigationHandleImplTest.
test_handle_->WillStartRequest(
"GET", nullptr, Referrer(), false, ui::PAGE_TRANSITION_LINK, false,
+ REQUEST_CONTEXT_TYPE_LOCATION,
base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult,
base::Unretained(this)));
}
@@ -178,6 +182,24 @@ class NavigationHandleImplTest : public RenderViewHostImplTestHarness {
NavigationThrottle::ThrottleCheckResult callback_result_;
};
+// Checks that the request_context_type is properly set.
+// Note: can be extended to cover more internal members.
+TEST_F(NavigationHandleImplTest, SimpleDataChecks) {
+ SimulateWillStartRequest();
+ EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION,
+ test_handle()->GetRequestContextType());
+
+ test_handle()->Resume();
+ SimulateWillRedirectRequest();
+ EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION,
+ test_handle()->GetRequestContextType());
+
+ test_handle()->Resume();
+ SimulateWillProcessResponse();
+ EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION,
+ test_handle()->GetRequestContextType());
+}
+
// Checks that a deferred navigation can be properly resumed.
TEST_F(NavigationHandleImplTest, ResumeDeferred) {
TestNavigationThrottle* test_throttle =
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl_browsertest.cc ('k') | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698