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

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

Issue 197283012: Retry requests on reused sockets that receive ERR_EMPTY_RESPONSE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/http/http_stream_factory_test_util.h"
6
7 #include "base/message_loop/message_loop.h"
8
9 namespace net {
10
11 MockHttpStreamFactoryImplForPreconnect::MockHttpStreamFactoryImplForPreconnect(
12 HttpNetworkSession* session,
13 bool for_websockets)
14 : HttpStreamFactoryImpl(session, for_websockets),
15 preconnect_done_(false),
16 waiting_for_preconnect_(false) {
17 }
18
19 void MockHttpStreamFactoryImplForPreconnect::WaitForPreconnects() {
20 while (!preconnect_done_) {
21 waiting_for_preconnect_ = true;
22 base::MessageLoop::current()->Run();
mmenke 2014/03/14 16:38:06 optional: Maybe switch to using a RunLoop, while
davidben 2014/03/14 18:35:03 Done.
23 waiting_for_preconnect_ = false;
24 }
25 }
26
27 void MockHttpStreamFactoryImplForPreconnect::OnPreconnectsCompleteInternal() {
28 preconnect_done_ = true;
29 if (waiting_for_preconnect_)
30 base::MessageLoop::current()->Quit();
31 }
32
33 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698