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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data_unittest.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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 unified diff | Download patch
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 "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"
10 #include "base/message_loop/message_loop_proxy.h"
11 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
12 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
13 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/single_thread_task_runner.h"
14 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
15 #include "base/time/time.h" 14 #include "base/time/time.h"
16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h"
17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ est_options.h" 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ est_options.h"
18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test _utils.h" 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test _utils.h"
19 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 18 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
20 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" 19 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h"
21 20
22 #include "net/http/http_network_session.h" 21 #include "net/http/http_network_session.h"
23 #include "net/log/net_log.h" 22 #include "net/log/net_log.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 61
63 class DataReductionProxyIODataTest : public testing::Test { 62 class DataReductionProxyIODataTest : public testing::Test {
64 public: 63 public:
65 void SetUp() override { 64 void SetUp() override {
66 RegisterSimpleProfilePrefs(prefs_.registry()); 65 RegisterSimpleProfilePrefs(prefs_.registry());
67 } 66 }
68 67
69 void RequestCallback(int err) { 68 void RequestCallback(int err) {
70 } 69 }
71 70
72 71 scoped_refptr<base::SingleThreadTaskRunner> task_runner() {
73 scoped_refptr<base::MessageLoopProxy> message_loop_proxy() { 72 return loop_.task_runner();
74 return loop_.message_loop_proxy();
75 } 73 }
76 74
77 net::TestDelegate* delegate() { 75 net::TestDelegate* delegate() {
78 return &delegate_; 76 return &delegate_;
79 } 77 }
80 78
81 const net::TestURLRequestContext& context() const { 79 const net::TestURLRequestContext& context() const {
82 return context_; 80 return context_;
83 } 81 }
84 82
85 net::NetLog* net_log() { 83 net::NetLog* net_log() {
86 return &net_log_; 84 return &net_log_;
87 } 85 }
88 86
89 PrefService* prefs() { 87 PrefService* prefs() {
90 return &prefs_; 88 return &prefs_;
91 } 89 }
92 90
93 private: 91 private:
94 base::MessageLoopForIO loop_; 92 base::MessageLoopForIO loop_;
95 net::TestDelegate delegate_; 93 net::TestDelegate delegate_;
96 net::TestURLRequestContext context_; 94 net::TestURLRequestContext context_;
97 net::NetLog net_log_; 95 net::NetLog net_log_;
98 TestingPrefServiceSimple prefs_; 96 TestingPrefServiceSimple prefs_;
99 }; 97 };
100 98
101 TEST_F(DataReductionProxyIODataTest, TestConstruction) { 99 TEST_F(DataReductionProxyIODataTest, TestConstruction) {
102 scoped_ptr<DataReductionProxyIOData> io_data(new DataReductionProxyIOData( 100 scoped_ptr<DataReductionProxyIOData> io_data(new DataReductionProxyIOData(
103 Client::UNKNOWN, DataReductionProxyParams::kAllowed, net_log(), 101 Client::UNKNOWN, DataReductionProxyParams::kAllowed, net_log(),
104 message_loop_proxy(), message_loop_proxy(), false /* enabled */, 102 task_runner(), task_runner(), false /* enabled */,
105 false /* enable_quic */, std::string() /* user_agent */)); 103 false /* enable_quic */, std::string() /* user_agent */));
106 104
107 // Check that the SimpleURLRequestContextGetter uses vanilla HTTP. 105 // Check that the SimpleURLRequestContextGetter uses vanilla HTTP.
108 net::URLRequestContext* request_context = 106 net::URLRequestContext* request_context =
109 io_data->basic_url_request_context_getter_.get()->GetURLRequestContext(); 107 io_data->basic_url_request_context_getter_.get()->GetURLRequestContext();
110 const net::HttpNetworkSession::Params* http_params = 108 const net::HttpNetworkSession::Params* http_params =
111 request_context->GetNetworkSessionParams(); 109 request_context->GetNetworkSessionParams();
112 EXPECT_TRUE(http_params->use_alternate_protocols); 110 EXPECT_TRUE(http_params->use_alternate_protocols);
113 EXPECT_FALSE(http_params->enable_quic); 111 EXPECT_FALSE(http_params->enable_quic);
114 net::NextProtoVector expected_protos = 112 net::NextProtoVector expected_protos =
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 187
190 // Turn Data Saver off. 188 // Turn Data Saver off.
191 drp_test_context->settings()->SetDataReductionProxyEnabled(false); 189 drp_test_context->settings()->SetDataReductionProxyEnabled(false);
192 base::RunLoop().RunUntilIdle(); 190 base::RunLoop().RunUntilIdle();
193 191
194 // Verify that bad proxy list is empty. 192 // Verify that bad proxy list is empty.
195 EXPECT_EQ(0UL, bad_proxy_list.size()); 193 EXPECT_EQ(0UL, bad_proxy_list.size());
196 } 194 }
197 195
198 } // namespace data_reduction_proxy 196 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698