OLD | NEW |
---|---|
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/test/embedded_test_server/embedded_test_server.h" | 5 #include "net/test/embedded_test_server/embedded_test_server.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 { | 71 { |
72 // Thread::Join induced by test code should cause an assert. | 72 // Thread::Join induced by test code should cause an assert. |
73 base::ThreadRestrictions::ScopedAllowIO allow_io_for_thread_join; | 73 base::ThreadRestrictions::ScopedAllowIO allow_io_for_thread_join; |
74 | 74 |
75 io_thread_.reset(); | 75 io_thread_.reset(); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 void EmbeddedTestServer::SetConnectionListener( | 79 void EmbeddedTestServer::SetConnectionListener( |
80 EmbeddedTestServerConnectionListener* listener) { | 80 EmbeddedTestServerConnectionListener* listener) { |
81 DCHECK(!Started()); | 81 DCHECK(!io_thread_.get()); |
mmenke
2017/05/02 20:10:26
This makes sure that we haven't started the accept
| |
82 connection_listener_ = listener; | 82 connection_listener_ = listener; |
83 } | 83 } |
84 | 84 |
85 bool EmbeddedTestServer::Start() { | 85 bool EmbeddedTestServer::Start() { |
86 bool success = InitializeAndListen(); | 86 bool success = InitializeAndListen(); |
87 if (!success) | 87 if (!success) |
88 return false; | 88 return false; |
89 StartAcceptingConnections(); | 89 StartAcceptingConnections(); |
90 return true; | 90 return true; |
91 } | 91 } |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 run_loop.QuitClosure())) { | 478 run_loop.QuitClosure())) { |
479 return false; | 479 return false; |
480 } | 480 } |
481 run_loop.Run(); | 481 run_loop.Run(); |
482 | 482 |
483 return true; | 483 return true; |
484 } | 484 } |
485 | 485 |
486 } // namespace test_server | 486 } // namespace test_server |
487 } // namespace net | 487 } // namespace net |
OLD | NEW |