From b4c62ebe8a5bce337c64f9776c225cafc6a51a16 Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Wed, 14 Nov 2012 18:36:51 +0000 Subject: net: Update calls from RunAllPending() to RunUntilIdle(). RunAllPending() is deprecated and we should switch to RunUntilIdle(). BUG=131220 TBR=willchan@chromium.org Review URL: https://chromiumcodereview.appspot.com/11361263 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167705 0039d316-1c4b-4281-b951-d872f2087c98 --- net/websockets/websocket_job_spdy2_unittest.cc | 24 ++++++++++++------------ net/websockets/websocket_job_spdy3_unittest.cc | 24 ++++++++++++------------ net/websockets/websocket_throttle_unittest.cc | 16 ++++++++-------- 3 files changed, 32 insertions(+), 32 deletions(-) (limited to 'net/websockets') diff --git a/net/websockets/websocket_job_spdy2_unittest.cc b/net/websockets/websocket_job_spdy2_unittest.cc index f1ed00d..7c60195 100644 --- a/net/websockets/websocket_job_spdy2_unittest.cc +++ b/net/websockets/websocket_job_spdy2_unittest.cc @@ -580,7 +580,7 @@ void WebSocketJobSpdy2Test::TestSimpleHandshake() { SkipToConnecting(); DoSendRequest(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), @@ -590,7 +590,7 @@ void WebSocketJobSpdy2Test::TestSimpleHandshake() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithoutCookie, kHandshakeResponseWithoutCookieLength); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); CloseWebSocketJob(); @@ -605,7 +605,7 @@ void WebSocketJobSpdy2Test::TestSlowHandshake() { DoSendRequest(); // We assume request is sent in one data chunk (from WebKit) // We don't support streaming request. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), @@ -620,12 +620,12 @@ void WebSocketJobSpdy2Test::TestSlowHandshake() { websocket_->OnReceivedData(socket_, line.c_str(), line.size()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(delegate.received_data().empty()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); } websocket_->OnReceivedData(socket_.get(), "\r\n", 2); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(delegate.received_data().empty()); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -654,7 +654,7 @@ TEST_F(WebSocketJobSpdy2Test, DelayedCookies) { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithFilteredCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, @@ -665,7 +665,7 @@ TEST_F(WebSocketJobSpdy2Test, DelayedCookies) { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -689,7 +689,7 @@ void WebSocketJobSpdy2Test::TestHandshakeWithCookie() { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithFilteredCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, @@ -700,7 +700,7 @@ void WebSocketJobSpdy2Test::TestHandshakeWithCookie() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -733,7 +733,7 @@ void WebSocketJobSpdy2Test::TestHandshakeWithCookieButNotAllowed() { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, kHandshakeRequestWithoutCookieLength); @@ -743,7 +743,7 @@ void WebSocketJobSpdy2Test::TestHandshakeWithCookieButNotAllowed() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -783,7 +783,7 @@ void WebSocketJobSpdy2Test::TestInvalidSendData() { DoSendRequest(); // We assume request is sent in one data chunk (from WebKit) // We don't support streaming request. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), diff --git a/net/websockets/websocket_job_spdy3_unittest.cc b/net/websockets/websocket_job_spdy3_unittest.cc index b758252..be36fc7 100644 --- a/net/websockets/websocket_job_spdy3_unittest.cc +++ b/net/websockets/websocket_job_spdy3_unittest.cc @@ -579,7 +579,7 @@ void WebSocketJobSpdy3Test::TestSimpleHandshake() { SkipToConnecting(); DoSendRequest(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), @@ -589,7 +589,7 @@ void WebSocketJobSpdy3Test::TestSimpleHandshake() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithoutCookie, kHandshakeResponseWithoutCookieLength); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); CloseWebSocketJob(); @@ -604,7 +604,7 @@ void WebSocketJobSpdy3Test::TestSlowHandshake() { DoSendRequest(); // We assume request is sent in one data chunk (from WebKit) // We don't support streaming request. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), @@ -619,12 +619,12 @@ void WebSocketJobSpdy3Test::TestSlowHandshake() { websocket_->OnReceivedData(socket_, line.c_str(), line.size()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(delegate.received_data().empty()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); } websocket_->OnReceivedData(socket_.get(), "\r\n", 2); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(delegate.received_data().empty()); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -653,7 +653,7 @@ TEST_F(WebSocketJobSpdy3Test, DelayedCookies) { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithFilteredCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, @@ -664,7 +664,7 @@ TEST_F(WebSocketJobSpdy3Test, DelayedCookies) { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -688,7 +688,7 @@ void WebSocketJobSpdy3Test::TestHandshakeWithCookie() { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithFilteredCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, @@ -699,7 +699,7 @@ void WebSocketJobSpdy3Test::TestHandshakeWithCookie() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -732,7 +732,7 @@ void WebSocketJobSpdy3Test::TestHandshakeWithCookieButNotAllowed() { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, kHandshakeRequestWithoutCookieLength); @@ -742,7 +742,7 @@ void WebSocketJobSpdy3Test::TestHandshakeWithCookieButNotAllowed() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -782,7 +782,7 @@ void WebSocketJobSpdy3Test::TestInvalidSendData() { DoSendRequest(); // We assume request is sent in one data chunk (from WebKit) // We don't support streaming request. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), diff --git a/net/websockets/websocket_throttle_unittest.cc b/net/websockets/websocket_throttle_unittest.cc index af3e022..ef05c4c 100644 --- a/net/websockets/websocket_throttle_unittest.cc +++ b/net/websockets/websocket_throttle_unittest.cc @@ -210,7 +210,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { "\r\n" "8jKS'y:G*Co,Wxa-"; w1->OnReceivedData(s1.get(), kHeader2, sizeof(kHeader2) - 1); - MessageLoopForIO::current()->RunAllPending(); + MessageLoopForIO::current()->RunUntilIdle(); // Now, w1 is open. EXPECT_EQ(WebSocketJob::OPEN, w1->state()); // So, w2 and w3 can start connecting. w4 needs to wait w2 (1.2.3.4) @@ -225,7 +225,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { // Closing s1 doesn't change waiting queue. DVLOG(1) << "socket1 close"; w1->OnClose(s1.get()); - MessageLoopForIO::current()->RunAllPending(); + MessageLoopForIO::current()->RunUntilIdle(); EXPECT_FALSE(callback_s4.have_result()); s1->DetachDelegate(); // Address | head -> tail @@ -238,7 +238,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { // w5 close() closes SocketStream that change state to STATE_CLOSE, calls // DoLoop(), so OnClose() callback will be called. w5->OnClose(s5.get()); - MessageLoopForIO::current()->RunAllPending(); + MessageLoopForIO::current()->RunUntilIdle(); EXPECT_FALSE(callback_s4.have_result()); // Address | head -> tail // 1.2.3.4 | w2 w4 @@ -249,7 +249,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { // w6 close abnormally (e.g. renderer finishes) while waiting in queue. DVLOG(1) << "socket6 close abnormally"; w6->DetachDelegate(); - MessageLoopForIO::current()->RunAllPending(); + MessageLoopForIO::current()->RunUntilIdle(); EXPECT_FALSE(callback_s4.have_result()); // Address | head -> tail // 1.2.3.4 | w2 w4 @@ -259,7 +259,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { // Closing s2 kicks w4 to start connecting. DVLOG(1) << "socket2 close"; w2->OnClose(s2.get()); - MessageLoopForIO::current()->RunAllPending(); + MessageLoopForIO::current()->RunUntilIdle(); EXPECT_TRUE(callback_s4.have_result()); // Address | head -> tail // 1.2.3.4 | w4 @@ -269,12 +269,12 @@ TEST_F(WebSocketThrottleTest, Throttle) { DVLOG(1) << "socket3 close"; w3->OnClose(s3.get()); - MessageLoopForIO::current()->RunAllPending(); + MessageLoopForIO::current()->RunUntilIdle(); s3->DetachDelegate(); w4->OnClose(s4.get()); s4->DetachDelegate(); DVLOG(1) << "Done"; - MessageLoopForIO::current()->RunAllPending(); + MessageLoopForIO::current()->RunUntilIdle(); } TEST_F(WebSocketThrottleTest, NoThrottleForDuplicateAddress) { @@ -302,7 +302,7 @@ TEST_F(WebSocketThrottleTest, NoThrottleForDuplicateAddress) { w1->OnClose(s1.get()); s1->DetachDelegate(); DVLOG(1) << "Done"; - MessageLoopForIO::current()->RunAllPending(); + MessageLoopForIO::current()->RunUntilIdle(); } } -- cgit v1.1