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
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_CHROMEDRIVER_NET_SYNC_WEBSOCKET_H_
6 #define CHROME_TEST_CHROMEDRIVER_NET_SYNC_WEBSOCKET_H_
12 // Proxy for using a WebSocket running on a background thread synchronously.
15 virtual ~SyncWebSocket() {}
17 // Return true if connected, otherwise return false.
18 virtual bool IsConnected() = 0;
20 // Connects to the WebSocket server. Returns true on success.
21 virtual bool Connect(const GURL
& url
) = 0;
23 // Sends message. Returns true on success.
24 virtual bool Send(const std::string
& message
) = 0;
26 // Receives next message. Blocks until at least one message is received or
27 // the socket is closed. Returns true on success and modifies |message|.
28 virtual bool ReceiveNextMessage(std::string
* message
) = 0;
30 // Returns whether there are any messages that have been received and not yet
31 // handled by ReceiveNextMessage.
32 virtual bool HasNextMessage() = 0;
35 #endif // CHROME_TEST_CHROMEDRIVER_NET_SYNC_WEBSOCKET_H_