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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl_unittest.cc

Issue 2461683002: Slice enum HttpResponseInfo::ConnectionInfo by QUIC version. (Closed)
Patch Set: Update recently introduced CONNECTION_INFO_QUIC occurrences. 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 unified diff | Download patch
« no previous file with comments | « components/domain_reliability/util.cc ('k') | net/http/http_response_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/macros.h" 5 #include "base/macros.h"
6 #include "content/browser/frame_host/navigation_handle_impl.h" 6 #include "content/browser/frame_host/navigation_handle_impl.h"
7 #include "content/public/browser/navigation_throttle.h" 7 #include "content/public/browser/navigation_throttle.h"
8 #include "content/public/browser/ssl_status.h" 8 #include "content/public/browser/ssl_status.h"
9 #include "content/public/common/request_context_type.h" 9 #include "content/public/common/request_context_type.h"
10 #include "content/test/test_render_frame_host.h" 10 #include "content/test/test_render_frame_host.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void SimulateWillProcessResponse() { 140 void SimulateWillProcessResponse() {
141 was_callback_called_ = false; 141 was_callback_called_ = false;
142 callback_result_ = NavigationThrottle::DEFER; 142 callback_result_ = NavigationThrottle::DEFER;
143 143
144 // It's safe to use base::Unretained since the NavigationHandle is owned 144 // It's safe to use base::Unretained since the NavigationHandle is owned
145 // by the NavigationHandleImplTest. The ConnectionInfo is different from 145 // by the NavigationHandleImplTest. The ConnectionInfo is different from
146 // that sent to WillRedirectRequest to verify that it's correctly plumbed 146 // that sent to WillRedirectRequest to verify that it's correctly plumbed
147 // in both cases. 147 // in both cases.
148 test_handle_->WillProcessResponse( 148 test_handle_->WillProcessResponse(
149 main_test_rfh(), scoped_refptr<net::HttpResponseHeaders>(), 149 main_test_rfh(), scoped_refptr<net::HttpResponseHeaders>(),
150 net::HttpResponseInfo::CONNECTION_INFO_QUIC, SSLStatus(), 150 net::HttpResponseInfo::CONNECTION_INFO_QUIC_35, SSLStatus(),
151 GlobalRequestID(), false, false, false, base::Closure(), 151 GlobalRequestID(), false, false, false, base::Closure(),
152 base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult, 152 base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult,
153 base::Unretained(this))); 153 base::Unretained(this)));
154 } 154 }
155 155
156 // Returns the handle used in tests. 156 // Returns the handle used in tests.
157 NavigationHandleImpl* test_handle() const { return test_handle_.get(); } 157 NavigationHandleImpl* test_handle() const { return test_handle_.get(); }
158 158
159 // Whether the callback was called. 159 // Whether the callback was called.
160 bool was_callback_called() const { return was_callback_called_; } 160 bool was_callback_called() const { return was_callback_called_; }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 SimulateWillRedirectRequest(); 202 SimulateWillRedirectRequest();
203 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, 203 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION,
204 test_handle()->GetRequestContextType()); 204 test_handle()->GetRequestContextType());
205 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, 205 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1,
206 test_handle()->GetConnectionInfo()); 206 test_handle()->GetConnectionInfo());
207 207
208 test_handle()->Resume(); 208 test_handle()->Resume();
209 SimulateWillProcessResponse(); 209 SimulateWillProcessResponse();
210 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, 210 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION,
211 test_handle()->GetRequestContextType()); 211 test_handle()->GetRequestContextType());
212 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC, 212 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC_35,
213 test_handle()->GetConnectionInfo()); 213 test_handle()->GetConnectionInfo());
214 } 214 }
215 215
216 TEST_F(NavigationHandleImplTest, SimpleDataCheckNoRedirect) { 216 TEST_F(NavigationHandleImplTest, SimpleDataCheckNoRedirect) {
217 SimulateWillStartRequest(); 217 SimulateWillStartRequest();
218 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, 218 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN,
219 test_handle()->GetConnectionInfo()); 219 test_handle()->GetConnectionInfo());
220 220
221 test_handle()->Resume(); 221 test_handle()->Resume();
222 SimulateWillProcessResponse(); 222 SimulateWillProcessResponse();
223 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC, 223 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC_35,
224 test_handle()->GetConnectionInfo()); 224 test_handle()->GetConnectionInfo());
225 } 225 }
226 226
227 // Checks that a deferred navigation can be properly resumed. 227 // Checks that a deferred navigation can be properly resumed.
228 TEST_F(NavigationHandleImplTest, ResumeDeferred) { 228 TEST_F(NavigationHandleImplTest, ResumeDeferred) {
229 TestNavigationThrottle* test_throttle = 229 TestNavigationThrottle* test_throttle =
230 CreateTestNavigationThrottle(NavigationThrottle::DEFER); 230 CreateTestNavigationThrottle(NavigationThrottle::DEFER);
231 EXPECT_FALSE(IsDeferringStart()); 231 EXPECT_FALSE(IsDeferringStart());
232 EXPECT_FALSE(IsDeferringRedirect()); 232 EXPECT_FALSE(IsDeferringRedirect());
233 EXPECT_FALSE(IsDeferringResponse()); 233 EXPECT_FALSE(IsDeferringResponse());
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result()); 685 EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result());
686 EXPECT_EQ(0, cancel_throttle->will_start_calls()); 686 EXPECT_EQ(0, cancel_throttle->will_start_calls());
687 EXPECT_EQ(0, cancel_throttle->will_redirect_calls()); 687 EXPECT_EQ(0, cancel_throttle->will_redirect_calls());
688 EXPECT_EQ(1, cancel_throttle->will_process_response_calls()); 688 EXPECT_EQ(1, cancel_throttle->will_process_response_calls());
689 EXPECT_EQ(0, proceed_throttle->will_start_calls()); 689 EXPECT_EQ(0, proceed_throttle->will_start_calls());
690 EXPECT_EQ(0, proceed_throttle->will_redirect_calls()); 690 EXPECT_EQ(0, proceed_throttle->will_redirect_calls());
691 EXPECT_EQ(0, proceed_throttle->will_process_response_calls()); 691 EXPECT_EQ(0, proceed_throttle->will_process_response_calls());
692 } 692 }
693 693
694 } // namespace content 694 } // namespace content
OLDNEW
« no previous file with comments | « components/domain_reliability/util.cc ('k') | net/http/http_response_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698