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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 explicit ServerThread(IPEndPoint address) | 59 explicit ServerThread(IPEndPoint address) |
60 : SimpleThread("server_thread"), | 60 : SimpleThread("server_thread"), |
61 listening_(true, false), | 61 listening_(true, false), |
62 quit_(true, false), | 62 quit_(true, false), |
63 address_(address), | 63 address_(address), |
64 port_(0) { | 64 port_(0) { |
65 } | 65 } |
66 virtual ~ServerThread() { | 66 virtual ~ServerThread() { |
67 } | 67 } |
68 | 68 |
69 virtual void Run() { | 69 virtual void Run() OVERRIDE { |
70 server_.Listen(address_); | 70 server_.Listen(address_); |
71 | 71 |
72 port_lock_.Acquire(); | 72 port_lock_.Acquire(); |
73 port_ = server_.port(); | 73 port_ = server_.port(); |
74 port_lock_.Release(); | 74 port_lock_.Release(); |
75 | 75 |
76 listening_.Signal(); | 76 listening_.Signal(); |
77 while (!quit_.IsSignaled()) { | 77 while (!quit_.IsSignaled()) { |
78 server_.WaitForEvents(); | 78 server_.WaitForEvents(); |
79 } | 79 } |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 EXPECT_EQ(200ul, client_->response_headers()->parsed_response_code()); | 522 EXPECT_EQ(200ul, client_->response_headers()->parsed_response_code()); |
523 client_->ResetConnection(); | 523 client_->ResetConnection(); |
524 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); | 524 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); |
525 EXPECT_EQ(200ul, client_->response_headers()->parsed_response_code()); | 525 EXPECT_EQ(200ul, client_->response_headers()->parsed_response_code()); |
526 } | 526 } |
527 | 527 |
528 } // namespace | 528 } // namespace |
529 } // namespace test | 529 } // namespace test |
530 } // namespace tools | 530 } // namespace tools |
531 } // namespace net | 531 } // namespace net |
OLD | NEW |