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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc

Issue 2771413004: DRP: Add check that ECT header is present when CPAT header is present. (Closed)
Patch Set: dougarnett comments Created 3 years, 9 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: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
index c2b816f9c76a229b9cfa04eae538277beee9c8a0..56c33b9b0dd478090a0fdaf5b18bbde858a9ead7 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
@@ -633,6 +633,11 @@ TEST_F(DataReductionProxyNetworkDelegateTest, AuthenticationTest) {
data_reduction_proxy_info.UseNamedProxy(data_reduction_proxy);
net::HttpRequestHeaders headers;
+ network_delegate()->NotifyBeforeStartTransaction(
megjablon 2017/03/29 22:20:01 Why are these NotifyBeforeStartTransaction calls n
tbansal1 2017/03/29 22:37:54 Done. ECT/CPAT headers are added in NotifyBeforeSt
+ fake_request.get(),
+ base::Bind(&DataReductionProxyNetworkDelegateTest::DelegateStageDone,
+ base::Unretained(this)),
+ &headers);
network_delegate()->NotifyBeforeSendHeaders(fake_request.get(),
data_reduction_proxy_info,
proxy_retry_info, &headers);
@@ -843,6 +848,11 @@ TEST_F(DataReductionProxyNetworkDelegateTest, RequestDataConfigurations) {
: 0);
lofi_decider()->SetIsUsingLoFi(test.lofi_on);
io_data()->request_options()->SetSecureSession("fake-session");
+ network_delegate()->NotifyBeforeStartTransaction(
+ request.get(),
+ base::Bind(&DataReductionProxyNetworkDelegateTest::DelegateStageDone,
+ base::Unretained(this)),
+ &headers);
network_delegate()->NotifyBeforeSendHeaders(
request.get(), data_reduction_proxy_info, proxy_retry_info, &headers);
DataReductionProxyData* data =
@@ -918,7 +928,7 @@ TEST_F(DataReductionProxyNetworkDelegateTest, RedirectRequestDataCleared) {
data_reduction_proxy_info.UseNamedProxy(data_reduction_proxy);
// Main frame loaded. Lo-Fi should be used.
- net::HttpRequestHeaders headers;
+ net::HttpRequestHeaders headers_original;
net::ProxyRetryInfoMap proxy_retry_info;
test_network_quality_estimator()->set_effective_connection_type(
@@ -929,8 +939,14 @@ TEST_F(DataReductionProxyNetworkDelegateTest, RedirectRequestDataCleared) {
request->SetLoadFlags(net::LOAD_MAIN_FRAME_DEPRECATED);
lofi_decider()->SetIsUsingLoFi(true);
io_data()->request_options()->SetSecureSession("fake-session");
+ network_delegate()->NotifyBeforeStartTransaction(
+ request.get(),
+ base::Bind(&DataReductionProxyNetworkDelegateTest::DelegateStageDone,
+ base::Unretained(this)),
+ &headers_original);
network_delegate()->NotifyBeforeSendHeaders(
- request.get(), data_reduction_proxy_info, proxy_retry_info, &headers);
+ request.get(), data_reduction_proxy_info, proxy_retry_info,
+ &headers_original);
DataReductionProxyData* data =
DataReductionProxyData::GetData(*request.get());
@@ -952,8 +968,15 @@ TEST_F(DataReductionProxyNetworkDelegateTest, RedirectRequestDataCleared) {
// Call NotifyBeforeSendHeaders again with different proxy info to check that
// new data isn't added.
+ net::HttpRequestHeaders headers_redirect;
+ network_delegate()->NotifyBeforeStartTransaction(
+ request.get(),
+ base::Bind(&DataReductionProxyNetworkDelegateTest::DelegateStageDone,
+ base::Unretained(this)),
+ &headers_redirect);
network_delegate()->NotifyBeforeSendHeaders(
- request.get(), data_reduction_proxy_info, proxy_retry_info, &headers);
+ request.get(), data_reduction_proxy_info, proxy_retry_info,
+ &headers_redirect);
data = DataReductionProxyData::GetData(*request.get());
EXPECT_FALSE(data);
}

Powered by Google App Engine
This is Rietveld 408576698