Suppression for crbug/241044.
[chromium-blink-merge.git] / chrome / test / chromedriver / net / sync_websocket.h
blobf54d116b18c6536e07636b75b9b0209a27a53cab
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_
8 #include <string>
10 class GURL;
12 // Proxy for using a WebSocket running on a background thread synchronously.
13 class SyncWebSocket {
14 public:
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_