| Index: chrome/test/chromedriver/net/port_server_unittest.cc
|
| diff --git a/chrome/test/chromedriver/net/port_server_unittest.cc b/chrome/test/chromedriver/net/port_server_unittest.cc
|
| index f96043ad062b698975b98337253124ec6f7870c7..998987c2d1ebade401d27ae6037d37e6bf9856ac 100644
|
| --- a/chrome/test/chromedriver/net/port_server_unittest.cc
|
| +++ b/chrome/test/chromedriver/net/port_server_unittest.cc
|
| @@ -189,7 +189,7 @@ TEST_F(PortServerTest, ReserveReserve) {
|
| #endif
|
|
|
| TEST(PortManagerTest, Reserve) {
|
| - PortManager mgr(15000, 16000);
|
| + PortManager mgr(15000, 16000, false);
|
| int port = 0;
|
| scoped_ptr<PortReservation> reservation;
|
| Status status = mgr.ReservePort(&port, &reservation);
|
| @@ -199,3 +199,21 @@ TEST(PortManagerTest, Reserve) {
|
| ASSERT_LE(port, 16000);
|
| ASSERT_TRUE(reservation);
|
| }
|
| +
|
| +TEST(PortManagerTest, Reuse) {
|
| + PortManager mgr(15000, 16000, true);
|
| + int first_port = 0, port = 1;
|
| + for (int i = 0; i < 10; i++)
|
| + {
|
| + scoped_ptr<PortReservation> reservation;
|
| + Status status = mgr.ReservePort(&port, &reservation);
|
| + ASSERT_EQ(kOk, status.code()) << status.message();
|
| + ASSERT_TRUE(reservation);
|
| + ASSERT_GE(port, 15000);
|
| + ASSERT_LE(port, 16000);
|
| + if (i == 0)
|
| + first_port = port;
|
| + else
|
| + ASSERT_EQ(port, first_port);
|
| + }
|
| +}
|
|
|