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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "content/browser/browser_thread_impl.h" | 7 #include "content/browser/browser_thread_impl.h" |
8 #include "content/public/browser/devtools_http_handler.h" | 8 #include "content/public/browser/devtools_http_handler.h" |
9 #include "content/public/browser/devtools_http_handler_delegate.h" | 9 #include "content/public/browser/devtools_http_handler_delegate.h" |
10 #include "net/socket/stream_listen_socket.h" | 10 #include "net/socket/stream_listen_socket.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 protected: | 88 protected: |
89 virtual void SetUp() { | 89 virtual void SetUp() { |
90 file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE)); | 90 file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE)); |
91 file_thread_->Start(); | 91 file_thread_->Start(); |
92 } | 92 } |
93 virtual void TearDown() { | 93 virtual void TearDown() { |
94 file_thread_->Stop(); | 94 file_thread_->Stop(); |
95 } | 95 } |
96 private: | 96 private: |
97 MessageLoopForIO message_loop_; | 97 base::MessageLoopForIO message_loop_; |
98 BrowserThreadImpl ui_thread_; | 98 BrowserThreadImpl ui_thread_; |
99 scoped_ptr<BrowserThreadImpl> file_thread_; | 99 scoped_ptr<BrowserThreadImpl> file_thread_; |
100 }; | 100 }; |
101 | 101 |
102 TEST_F(DevToolsHttpHandlerTest, TestStartStop) { | 102 TEST_F(DevToolsHttpHandlerTest, TestStartStop) { |
103 base::RunLoop run_loop, run_loop_2; | 103 base::RunLoop run_loop, run_loop_2; |
104 content::DevToolsHttpHandler* devtools_http_handler_ = | 104 content::DevToolsHttpHandler* devtools_http_handler_ = |
105 content::DevToolsHttpHandler::Start( | 105 content::DevToolsHttpHandler::Start( |
106 new DummyListenSocketFactory(run_loop.QuitClosure(), | 106 new DummyListenSocketFactory(run_loop.QuitClosure(), |
107 run_loop_2.QuitClosure()), | 107 run_loop_2.QuitClosure()), |
108 std::string(), | 108 std::string(), |
109 new DummyDelegate()); | 109 new DummyDelegate()); |
110 // Our dummy socket factory will post a quit message once the server will | 110 // Our dummy socket factory will post a quit message once the server will |
111 // become ready. | 111 // become ready. |
112 run_loop.Run(); | 112 run_loop.Run(); |
113 devtools_http_handler_->Stop(); | 113 devtools_http_handler_->Stop(); |
114 // Make sure the handler actually stops. | 114 // Make sure the handler actually stops. |
115 run_loop_2.Run(); | 115 run_loop_2.Run(); |
116 } | 116 } |
117 | 117 |
118 } // namespace content | 118 } // namespace content |
OLD | NEW |