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

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

Issue 2457583007: [PageLoadMetrics] Create page load timing metrics for H2/QUIC/H1 pages (Closed)
Patch Set: Address comments from PS6 Created 4 years, 1 month 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 fc78314c663dea77f9b6eafc7041ccf649173033..b1fae61cb5728348d91718ba6503798d60e08b1b 100644
--- a/content/browser/frame_host/navigation_handle_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_handle_impl_unittest.cc
@@ -127,6 +127,7 @@ class NavigationHandleImplTest : public RenderViewHostImplTestHarness {
// the NavigationHandleImplTest.
test_handle_->WillRedirectRequest(
GURL(), "GET", GURL(), false, scoped_refptr<net::HttpResponseHeaders>(),
+ net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1,
base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult,
base::Unretained(this)));
}
@@ -140,11 +141,13 @@ class NavigationHandleImplTest : public RenderViewHostImplTestHarness {
was_callback_called_ = false;
callback_result_ = NavigationThrottle::DEFER;
- // It's safe to use base::Unretained since the NavigationHandle is owned by
- // the NavigationHandleImplTest.
+ // It's safe to use base::Unretained since the NavigationHandle is owned
+ // by the NavigationHandleImplTest. The ConnectionInfo is different from
+ // that sent to WillRedirectRequest to verify that it's correctly plumbed
+ // in both cases.
test_handle_->WillProcessResponse(
- main_test_rfh(),
- scoped_refptr<net::HttpResponseHeaders>(), SSLStatus(),
+ main_test_rfh(), scoped_refptr<net::HttpResponseHeaders>(),
+ net::HttpResponseInfo::CONNECTION_INFO_QUIC, SSLStatus(),
GlobalRequestID(), false, false, false, base::Closure(),
base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult,
base::Unretained(this)));
@@ -192,16 +195,33 @@ TEST_F(NavigationHandleImplTest, SimpleDataChecks) {
SimulateWillStartRequest();
EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION,
test_handle()->GetRequestContextType());
+ EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN,
+ test_handle()->GetConnectionInfo());
test_handle()->Resume();
SimulateWillRedirectRequest();
EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION,
test_handle()->GetRequestContextType());
+ EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1,
+ test_handle()->GetConnectionInfo());
test_handle()->Resume();
SimulateWillProcessResponse();
EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION,
test_handle()->GetRequestContextType());
+ EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC,
+ test_handle()->GetConnectionInfo());
+}
+
+TEST_F(NavigationHandleImplTest, SimpleDataCheckNoRedirect) {
+ SimulateWillStartRequest();
+ EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN,
+ test_handle()->GetConnectionInfo());
+
+ test_handle()->Resume();
+ SimulateWillProcessResponse();
+ EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC,
+ test_handle()->GetConnectionInfo());
}
// Checks that a deferred navigation can be properly resumed.
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.cc ('k') | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698