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/files/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 } | 94 } |
95 | 95 |
96 class DevToolsHttpHandlerTest : public testing::Test { | 96 class DevToolsHttpHandlerTest : public testing::Test { |
97 public: | 97 public: |
98 DevToolsHttpHandlerTest() | 98 DevToolsHttpHandlerTest() |
99 : ui_thread_(BrowserThread::UI, &message_loop_) { | 99 : ui_thread_(BrowserThread::UI, &message_loop_) { |
100 } | 100 } |
101 | 101 |
102 protected: | 102 protected: |
103 virtual void SetUp() { | 103 void SetUp() override { |
104 file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE)); | 104 file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE)); |
105 file_thread_->Start(); | 105 file_thread_->Start(); |
106 } | 106 } |
107 | 107 |
108 virtual void TearDown() { | 108 void TearDown() override { file_thread_->Stop(); } |
109 file_thread_->Stop(); | |
110 } | |
111 | 109 |
112 private: | 110 private: |
113 base::MessageLoopForIO message_loop_; | 111 base::MessageLoopForIO message_loop_; |
114 BrowserThreadImpl ui_thread_; | 112 BrowserThreadImpl ui_thread_; |
115 scoped_ptr<BrowserThreadImpl> file_thread_; | 113 scoped_ptr<BrowserThreadImpl> file_thread_; |
116 }; | 114 }; |
117 | 115 |
118 TEST_F(DevToolsHttpHandlerTest, TestStartStop) { | 116 TEST_F(DevToolsHttpHandlerTest, TestStartStop) { |
119 base::RunLoop run_loop, run_loop_2; | 117 base::RunLoop run_loop, run_loop_2; |
120 scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> factory( | 118 scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> factory( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 kDevToolsActivePortFileName); | 156 kDevToolsActivePortFileName); |
159 EXPECT_TRUE(base::PathExists(active_port_file)); | 157 EXPECT_TRUE(base::PathExists(active_port_file)); |
160 std::string file_contents; | 158 std::string file_contents; |
161 EXPECT_TRUE(base::ReadFileToString(active_port_file, &file_contents)); | 159 EXPECT_TRUE(base::ReadFileToString(active_port_file, &file_contents)); |
162 int port = 0; | 160 int port = 0; |
163 EXPECT_TRUE(base::StringToInt(file_contents, &port)); | 161 EXPECT_TRUE(base::StringToInt(file_contents, &port)); |
164 EXPECT_EQ(kDummyPort, port); | 162 EXPECT_EQ(kDummyPort, port); |
165 } | 163 } |
166 | 164 |
167 } // namespace content | 165 } // namespace content |
OLD | NEW |