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

Unified Diff: chrome/test/chromedriver/net/port_server_unittest.cc

Issue 127143003: [chromedriver] Reuse forwarded adb ports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
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);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698