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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_stream_factory_test_util.cc
diff --git a/net/http/http_stream_factory_test_util.cc b/net/http/http_stream_factory_test_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4d0e78aca323d31b1d11cc569ba23994433bd226
--- /dev/null
+++ b/net/http/http_stream_factory_test_util.cc
@@ -0,0 +1,33 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/http/http_stream_factory_test_util.h"
+
+#include "base/message_loop/message_loop.h"
+
+namespace net {
+
+MockHttpStreamFactoryImplForPreconnect::MockHttpStreamFactoryImplForPreconnect(
+ HttpNetworkSession* session,
+ bool for_websockets)
+ : HttpStreamFactoryImpl(session, for_websockets),
+ preconnect_done_(false),
+ waiting_for_preconnect_(false) {
+}
+
+void MockHttpStreamFactoryImplForPreconnect::WaitForPreconnects() {
+ while (!preconnect_done_) {
+ waiting_for_preconnect_ = true;
+ 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.
+ waiting_for_preconnect_ = false;
+ }
+}
+
+void MockHttpStreamFactoryImplForPreconnect::OnPreconnectsCompleteInternal() {
+ preconnect_done_ = true;
+ if (waiting_for_preconnect_)
+ base::MessageLoop::current()->Quit();
+}
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698