Index: net/websockets/websocket_channel_test.cc |
diff --git a/net/websockets/websocket_channel_test.cc b/net/websockets/websocket_channel_test.cc |
index 040a903f9ab836817e42f7b291ac50c64c1fdb8b..dd2fa354b2c59f0b17e5e8d67d4992990b66a71a 100644 |
--- a/net/websockets/websocket_channel_test.cc |
+++ b/net/websockets/websocket_channel_test.cc |
@@ -23,6 +23,7 @@ |
#include "base/memory/ptr_util.h" |
#include "base/memory/weak_ptr.h" |
#include "base/message_loop/message_loop.h" |
+#include "base/run_loop.h" |
#include "base/single_thread_task_runner.h" |
#include "base/strings/string_piece.h" |
#include "base/threading/thread_task_runner_handle.h" |
@@ -1068,7 +1069,7 @@ TEST_F(WebSocketChannelDeletingTest, OnDataFrameAsync) { |
CreateChannelAndConnectSuccessfully(); |
EXPECT_TRUE(channel_); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(nullptr, channel_.get()); |
} |
@@ -1116,7 +1117,7 @@ TEST_F(WebSocketChannelDeletingTest, OnClosingHandshakeAsync) { |
deleting_ = EVENT_ON_CLOSING_HANDSHAKE; |
CreateChannelAndConnectSuccessfully(); |
ASSERT_TRUE(channel_); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(nullptr, channel_.get()); |
} |
@@ -1139,7 +1140,7 @@ TEST_F(WebSocketChannelDeletingTest, OnDropChannelReadError) { |
deleting_ = EVENT_ON_DROP_CHANNEL; |
CreateChannelAndConnectSuccessfully(); |
ASSERT_TRUE(channel_); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(nullptr, channel_.get()); |
} |
@@ -1158,7 +1159,7 @@ TEST_F(WebSocketChannelDeletingTest, OnNotifyStartOpeningHandshakeError) { |
std::unique_ptr<WebSocketHandshakeRequestInfo>( |
new WebSocketHandshakeRequestInfo(GURL("http://www.example.com/"), |
base::Time()))); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(nullptr, channel_.get()); |
} |
@@ -1179,7 +1180,7 @@ TEST_F(WebSocketChannelDeletingTest, OnNotifyFinishOpeningHandshakeError) { |
base::WrapUnique(new WebSocketHandshakeResponseInfo( |
GURL("http://www.example.com/"), 200, "OK", response_headers, |
base::Time()))); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(nullptr, channel_.get()); |
} |
@@ -1203,7 +1204,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelInOnReadDone) { |
deleting_ = EVENT_ON_FAIL_CHANNEL; |
CreateChannelAndConnectSuccessfully(); |
ASSERT_TRUE(channel_); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(nullptr, channel_.get()); |
} |
@@ -1453,7 +1454,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, NormalAsyncRead) { |
CreateChannelAndConnectSuccessfully(); |
checkpoint.Call(1); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
checkpoint.Call(2); |
} |
@@ -1484,7 +1485,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, AsyncThenSyncRead) { |
} |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// Data frames are delivered the same regardless of how many reads they arrive |
@@ -1538,7 +1539,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, FragmentedMessage) { |
} |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// A message can consist of one frame with null payload. |
@@ -1573,7 +1574,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, AsyncAbnormalClosure) { |
} |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// A connection reset should produce the same event as an unexpected closure. |
@@ -1592,7 +1593,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ConnectionReset) { |
} |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// RFC6455 5.1 "A client MUST close a connection if it detects a masked frame." |
@@ -1615,7 +1616,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, MaskedFramesAreRejected) { |
} |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// RFC6455 5.2 "If an unknown opcode is received, the receiving endpoint MUST |
@@ -1636,7 +1637,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, UnknownOpCodeIsRejected) { |
} |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// RFC6455 5.4 "Control frames ... MAY be injected in the middle of a |
@@ -1673,7 +1674,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ControlFrameInDataMessage) { |
} |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// It seems redundant to repeat the entirety of the above test, so just test a |
@@ -1689,7 +1690,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, PongWithNullData) { |
EXPECT_CALL(*event_interface_, OnFlowControl(_)); |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// If a frame has an invalid header, then the connection is closed and |
@@ -1714,7 +1715,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, FrameAfterInvalidFrame) { |
} |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// If the renderer sends lots of small writes, we don't want to update the quota |
@@ -1838,7 +1839,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, SendCloseDropsChannel) { |
ASSERT_EQ(CHANNEL_ALIVE, |
channel_->StartClosingHandshake(kWebSocketNormalClosure, "Fred")); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// StartClosingHandshake() also works before connection completes, and calls |
@@ -1866,7 +1867,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, OnDropChannelCalledOnce) { |
CreateChannelAndConnectSuccessfully(); |
channel_->SendFrame(true, WebSocketFrameHeader::kOpCodeText, AsVector("yt?")); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// When the remote server sends a Close frame with an empty payload, |
@@ -1938,7 +1939,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, AsyncProtocolErrorGivesStatus1002) { |
EXPECT_CALL(*event_interface_, OnFailChannel("Invalid frame header")); |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
TEST_F(WebSocketChannelEventInterfaceTest, StartHandshakeRequest) { |
@@ -1957,7 +1958,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, StartHandshakeRequest) { |
connect_data_.creator.connect_delegate->OnStartOpeningHandshake( |
std::move(request_info)); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
TEST_F(WebSocketChannelEventInterfaceTest, FinishHandshakeRequest) { |
@@ -1977,7 +1978,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, FinishHandshakeRequest) { |
"OK", response_headers, base::Time())); |
connect_data_.creator.connect_delegate->OnFinishOpeningHandshake( |
std::move(response_info)); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
TEST_F(WebSocketChannelEventInterfaceTest, FailJustAfterHandshake) { |
@@ -2004,7 +2005,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, FailJustAfterHandshake) { |
connect_delegate->OnFinishOpeningHandshake(std::move(response_info)); |
connect_delegate->OnFailure("bye"); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// Any frame after close is invalid. This test uses a Text frame. See also |
@@ -2364,7 +2365,7 @@ TEST_F(WebSocketChannelFlowControlTest, SingleFrameMessageSplitAsync) { |
CreateChannelAndConnectWithQuota(2); |
checkpoint.Call(1); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
checkpoint.Call(2); |
ASSERT_EQ(CHANNEL_ALIVE, channel_->SendFlowControl(1)); |
checkpoint.Call(3); |
@@ -3042,7 +3043,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ReceivedInvalidUtf8) { |
OnFailChannel("Could not decode a text frame as UTF-8.")); |
CreateChannelAndConnectSuccessfully(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
// Invalid UTF-8 is not sent over the network. |