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

Side by Side Diff: net/http/http_stream_factory_impl_unittest.cc

Issue 1398973003: Don't use base::MessageLoop::{Quit,QuitClosure} in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/http/http_stream_factory_impl.h" 5 #include "net/http/http_stream_factory_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 base::MessageLoop::current()->Run(); 123 base::MessageLoop::current()->Run();
124 waiting_for_preconnect_ = false; 124 waiting_for_preconnect_ = false;
125 } 125 }
126 } 126 }
127 127
128 private: 128 private:
129 // HttpStreamFactoryImpl methods. 129 // HttpStreamFactoryImpl methods.
130 void OnPreconnectsCompleteInternal() override { 130 void OnPreconnectsCompleteInternal() override {
131 preconnect_done_ = true; 131 preconnect_done_ = true;
132 if (waiting_for_preconnect_) 132 if (waiting_for_preconnect_)
133 base::MessageLoop::current()->Quit(); 133 base::MessageLoop::current()->QuitWhenIdle();
134 } 134 }
135 135
136 bool preconnect_done_; 136 bool preconnect_done_;
137 bool waiting_for_preconnect_; 137 bool waiting_for_preconnect_;
138 }; 138 };
139 139
140 class StreamRequestWaiter : public HttpStreamRequest::Delegate { 140 class StreamRequestWaiter : public HttpStreamRequest::Delegate {
141 public: 141 public:
142 StreamRequestWaiter() 142 StreamRequestWaiter()
143 : waiting_for_stream_(false), 143 : waiting_for_stream_(false),
144 stream_done_(false) {} 144 stream_done_(false) {}
145 145
146 // HttpStreamRequest::Delegate 146 // HttpStreamRequest::Delegate
147 147
148 void OnStreamReady(const SSLConfig& used_ssl_config, 148 void OnStreamReady(const SSLConfig& used_ssl_config,
149 const ProxyInfo& used_proxy_info, 149 const ProxyInfo& used_proxy_info,
150 HttpStream* stream) override { 150 HttpStream* stream) override {
151 stream_done_ = true; 151 stream_done_ = true;
152 if (waiting_for_stream_) 152 if (waiting_for_stream_)
153 base::MessageLoop::current()->Quit(); 153 base::MessageLoop::current()->QuitWhenIdle();
154 stream_.reset(stream); 154 stream_.reset(stream);
155 used_ssl_config_ = used_ssl_config; 155 used_ssl_config_ = used_ssl_config;
156 used_proxy_info_ = used_proxy_info; 156 used_proxy_info_ = used_proxy_info;
157 } 157 }
158 158
159 void OnWebSocketHandshakeStreamReady( 159 void OnWebSocketHandshakeStreamReady(
160 const SSLConfig& used_ssl_config, 160 const SSLConfig& used_ssl_config,
161 const ProxyInfo& used_proxy_info, 161 const ProxyInfo& used_proxy_info,
162 WebSocketHandshakeStreamBase* stream) override { 162 WebSocketHandshakeStreamBase* stream) override {
163 stream_done_ = true; 163 stream_done_ = true;
164 if (waiting_for_stream_) 164 if (waiting_for_stream_)
165 base::MessageLoop::current()->Quit(); 165 base::MessageLoop::current()->QuitWhenIdle();
166 websocket_stream_.reset(stream); 166 websocket_stream_.reset(stream);
167 used_ssl_config_ = used_ssl_config; 167 used_ssl_config_ = used_ssl_config;
168 used_proxy_info_ = used_proxy_info; 168 used_proxy_info_ = used_proxy_info;
169 } 169 }
170 170
171 void OnStreamFailed(int status, 171 void OnStreamFailed(int status,
172 const SSLConfig& used_ssl_config, 172 const SSLConfig& used_ssl_config,
173 SSLFailureState ssl_failure_state) override {} 173 SSLFailureState ssl_failure_state) override {}
174 174
175 void OnCertificateError(int status, 175 void OnCertificateError(int status,
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); 1427 EXPECT_TRUE(waiter.used_proxy_info().is_direct());
1428 1428
1429 // Make sure there is no orphaned job. it is already canceled. 1429 // Make sure there is no orphaned job. it is already canceled.
1430 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( 1430 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>(
1431 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); 1431 session->http_stream_factory_for_websocket())->num_orphaned_jobs());
1432 } 1432 }
1433 1433
1434 } // namespace 1434 } // namespace
1435 1435
1436 } // namespace net 1436 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties_manager_unittest.cc ('k') | net/http/http_transaction_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698