Chromium Code Reviews| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 ASSERT_FALSE(sock.ReceiveNextMessage(&message)); | 102 ASSERT_FALSE(sock.ReceiveNextMessage(&message)); |
| 103 ASSERT_STREQ("", message.c_str()); | 103 ASSERT_STREQ("", message.c_str()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 TEST_F(SyncWebSocketImplTest, CloseOnSend) { | 106 TEST_F(SyncWebSocketImplTest, CloseOnSend) { |
| 107 SyncWebSocketImpl sock(context_getter_); | 107 SyncWebSocketImpl sock(context_getter_); |
| 108 ASSERT_TRUE(sock.Connect(server_.web_socket_url())); | 108 ASSERT_TRUE(sock.Connect(server_.web_socket_url())); |
| 109 server_.Stop(); | 109 server_.Stop(); |
| 110 ASSERT_FALSE(sock.Send("1")); | 110 ASSERT_FALSE(sock.Send("1")); |
| 111 } | 111 } |
| 112 | |
| 113 TEST_F(SyncWebSocketImplTest, Reconnect) { | |
| 114 SyncWebSocketImpl sock(context_getter_); | |
| 115 ASSERT_TRUE(sock.Connect(server_.web_socket_url())); | |
| 116 ASSERT_TRUE(sock.Send("1")); | |
| 117 server_.Stop(); | |
| 118 ASSERT_FALSE(sock.Send("1")); | |
| 119 server_.Start(); | |
| 120 ASSERT_TRUE(sock.Connect(server_.web_socket_url())); | |
|
kkania
2013/02/22 01:35:24
how about check in this test that the message queu
chrisgao (Use stgao instead)
2013/02/27 19:29:44
Done.
| |
| 121 ASSERT_TRUE(sock.Send("1")); | |
| 122 } | |
| OLD | NEW |