OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // finished processing the previous message. | 272 // finished processing the previous message. |
273 EXPECT_FALSE(socket_.read_pending()); | 273 EXPECT_FALSE(socket_.read_pending()); |
274 | 274 |
275 done_task.Run(); | 275 done_task.Run(); |
276 | 276 |
277 EXPECT_TRUE(socket_.read_pending()); | 277 EXPECT_TRUE(socket_.read_pending()); |
278 } | 278 } |
279 | 279 |
280 // Read() returns error. | 280 // Read() returns error. |
281 TEST_F(MessageReaderTest, ReadError) { | 281 TEST_F(MessageReaderTest, ReadError) { |
282 socket_.set_next_read_error(net::ERR_FAILED); | 282 socket_.AppendReadError(net::ERR_FAILED); |
283 | 283 |
284 // Add a message. It should never be read after the error above. | 284 // Add a message. It should never be read after the error above. |
285 AddMessage(kTestMessage1); | 285 AddMessage(kTestMessage1); |
286 | 286 |
287 EXPECT_CALL(callback_, OnMessage(_)) | 287 EXPECT_CALL(callback_, OnMessage(_)) |
288 .Times(0); | 288 .Times(0); |
289 | 289 |
290 InitReader(); | 290 InitReader(); |
291 } | 291 } |
292 | 292 |
(...skipping 24 matching lines...) Expand all Loading... |
317 EXPECT_CALL(callback_, OnMessage(_)) | 317 EXPECT_CALL(callback_, OnMessage(_)) |
318 .Times(1) | 318 .Times(1) |
319 .WillOnce(Invoke(this, &MessageReaderTest::DeleteReader)); | 319 .WillOnce(Invoke(this, &MessageReaderTest::DeleteReader)); |
320 | 320 |
321 InitReader(); | 321 InitReader(); |
322 base::RunLoop().RunUntilIdle(); | 322 base::RunLoop().RunUntilIdle(); |
323 } | 323 } |
324 | 324 |
325 } // namespace protocol | 325 } // namespace protocol |
326 } // namespace remoting | 326 } // namespace remoting |
OLD | NEW |