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

Side by Side Diff: chrome/test/chromedriver/net/port_server_unittest.cc

Issue 1167163002: chrome: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing message_loop.h includes. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/sync_socket.h" 11 #include "base/sync_socket.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/test/chromedriver/chrome/status.h" 15 #include "chrome/test/chromedriver/chrome/status.h"
16 #include "chrome/test/chromedriver/net/port_server.h" 16 #include "chrome/test/chromedriver/net/port_server.h"
17 #include "net/base/sys_addrinfo.h" 17 #include "net/base/sys_addrinfo.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 #if defined(OS_LINUX) 20 #if defined(OS_LINUX)
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 class PortServerTest : public testing::Test { 117 class PortServerTest : public testing::Test {
118 public: 118 public:
119 PortServerTest() : thread_("server") { 119 PortServerTest() : thread_("server") {
120 EXPECT_TRUE(thread_.Start()); 120 EXPECT_TRUE(thread_.Start());
121 } 121 }
122 122
123 void RunServer(const std::string& path, 123 void RunServer(const std::string& path,
124 const std::string& response, 124 const std::string& response,
125 std::string* request) { 125 std::string* request) {
126 base::WaitableEvent listen_event(false, false); 126 base::WaitableEvent listen_event(false, false);
127 thread_.message_loop()->PostTask( 127 thread_.task_runner()->PostTask(
128 FROM_HERE, 128 FROM_HERE,
129 base::Bind( 129 base::Bind(&RunServerOnThread, path, response, &listen_event, request));
130 &RunServerOnThread, path, response, &listen_event, request));
131 ASSERT_TRUE(listen_event.TimedWait(base::TimeDelta::FromSeconds(5))); 130 ASSERT_TRUE(listen_event.TimedWait(base::TimeDelta::FromSeconds(5)));
132 } 131 }
133 132
134 private: 133 private:
135 base::Thread thread_; 134 base::Thread thread_;
136 }; 135 };
137 136
138 TEST_F(PortServerTest, Reserve) { 137 TEST_F(PortServerTest, Reserve) {
139 std::string path = GenerateRandomPath(); 138 std::string path = GenerateRandomPath();
140 PortServer server(path); 139 PortServer server(path);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 Status status = mgr.ReservePortFromPool(&port, &reservation); 207 Status status = mgr.ReservePortFromPool(&port, &reservation);
209 ASSERT_EQ(kOk, status.code()) << status.message(); 208 ASSERT_EQ(kOk, status.code()) << status.message();
210 ASSERT_TRUE(reservation); 209 ASSERT_TRUE(reservation);
211 ASSERT_GE(port, 15000); 210 ASSERT_GE(port, 15000);
212 ASSERT_LE(port, 16000); 211 ASSERT_LE(port, 16000);
213 if (i == 0) 212 if (i == 0)
214 first_port = port; 213 first_port = port;
215 ASSERT_EQ(port, first_port); 214 ASSERT_EQ(port, first_port);
216 } 215 }
217 } 216 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/net/net_util_unittest.cc ('k') | chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698