1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBSOCKETS_MOCK_WEBSOCKET_CHANNEL_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBSOCKETS_MOCK_WEBSOCKET_CHANNEL_H_
#include <memory>
#include "base/memory/scoped_refptr.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom-blink-forward.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h"
#include "third_party/blink/renderer/modules/websockets/websocket_channel.h"
#include "third_party/blink/renderer/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
class SourceLocation;
class MockWebSocketChannel : public WebSocketChannel {
public:
static MockWebSocketChannel* Create();
MockWebSocketChannel();
~MockWebSocketChannel() override;
MOCK_METHOD2(Connect, bool(const KURL&, const String&));
MOCK_METHOD2(Send,
WebSocketChannel::SendResult(const std::string&,
base::OnceClosure));
MOCK_METHOD4(Send,
WebSocketChannel::SendResult(const DOMArrayBuffer&,
unsigned,
unsigned,
base::OnceClosure));
MOCK_METHOD1(SendMock, void(BlobDataHandle*));
void Send(scoped_refptr<BlobDataHandle> handle) override {
SendMock(handle.get());
}
MOCK_CONST_METHOD0(BufferedAmount, unsigned());
MOCK_METHOD2(Close, void(int, const String&));
MOCK_METHOD3(FailMock,
void(const String&,
mojom::ConsoleMessageLevel,
SourceLocation*));
void Fail(const String& reason,
mojom::ConsoleMessageLevel level,
std::unique_ptr<SourceLocation> location) override {
FailMock(reason, level, location.get());
}
MOCK_METHOD0(Disconnect, void());
MOCK_METHOD0(CancelHandshake, void());
MOCK_METHOD0(ApplyBackpressure, void());
MOCK_METHOD0(RemoveBackpressure, void());
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBSOCKETS_MOCK_WEBSOCKET_CHANNEL_H_
|