OLD | NEW |
---|---|
(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 | |
OLD | NEW |