OLD | NEW |
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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 CountingNetworkDelegate* wrapped_network_delegate = | 107 CountingNetworkDelegate* wrapped_network_delegate = |
108 new CountingNetworkDelegate(); | 108 new CountingNetworkDelegate(); |
109 scoped_ptr<DataReductionProxyNetworkDelegate> network_delegate = | 109 scoped_ptr<DataReductionProxyNetworkDelegate> network_delegate = |
110 io_data->CreateNetworkDelegate( | 110 io_data->CreateNetworkDelegate( |
111 make_scoped_ptr(wrapped_network_delegate), false); | 111 make_scoped_ptr(wrapped_network_delegate), false); |
112 network_delegate->NotifyBeforeURLRequest( | 112 network_delegate->NotifyBeforeURLRequest( |
113 fake_request.get(), | 113 fake_request.get(), |
114 base::Bind(&DataReductionProxyIODataTest::RequestCallback, | 114 base::Bind(&DataReductionProxyIODataTest::RequestCallback, |
115 base::Unretained(this)), nullptr); | 115 base::Unretained(this)), nullptr); |
116 EXPECT_EQ(1, wrapped_network_delegate->created_requests()); | 116 EXPECT_EQ(1, wrapped_network_delegate->created_requests()); |
117 EXPECT_EQ(nullptr, io_data->usage_stats()); | 117 EXPECT_EQ(nullptr, io_data->bypass_stats()); |
118 | 118 |
119 // Creating a second delegate with bypass statistics tracking should result | 119 // Creating a second delegate with bypass statistics tracking should result |
120 // in usage stats being created. | 120 // in usage stats being created. |
121 io_data->CreateNetworkDelegate(make_scoped_ptr(new CountingNetworkDelegate()), | 121 io_data->CreateNetworkDelegate(make_scoped_ptr(new CountingNetworkDelegate()), |
122 true); | 122 true); |
123 EXPECT_NE(nullptr, io_data->usage_stats()); | 123 EXPECT_NE(nullptr, io_data->bypass_stats()); |
124 | 124 |
125 // The Data Reduction Proxy isn't actually enabled here. | 125 // The Data Reduction Proxy isn't actually enabled here. |
126 io_data->InitOnUIThread(prefs()); | 126 io_data->InitOnUIThread(prefs()); |
127 EXPECT_FALSE(io_data->IsEnabled()); | 127 EXPECT_FALSE(io_data->IsEnabled()); |
128 io_data->ShutdownOnUIThread(); | 128 io_data->ShutdownOnUIThread(); |
129 } | 129 } |
130 | 130 |
131 } // namespace data_reduction_proxy | 131 } // namespace data_reduction_proxy |
OLD | NEW |