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

Side by Side Diff: chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc

Issue 12321057: [chromedriver] Implement reconnection to DevTools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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("2"));
119 ASSERT_FALSE(sock.IsConnected());
120 server_.Start();
121 ASSERT_TRUE(sock.HasNextMessage());
122 ASSERT_TRUE(sock.Connect(server_.web_socket_url()));
123 ASSERT_FALSE(sock.HasNextMessage());
124 ASSERT_TRUE(sock.Send("3"));
125 std::string message;
126 ASSERT_TRUE(sock.ReceiveNextMessage(&message));
127 ASSERT_STREQ("3", message.c_str());
128 ASSERT_FALSE(sock.HasNextMessage());
129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698