Update mojo sdk to rev c02a28868825edfa57ab77947b8cb15e741c5598
[chromium-blink-merge.git] / components / test_runner / mock_webrtc_data_channel_handler.h
blobe23a61b8a76c8f50e99aa317fa14bb0e7b92a129
1 // Copyright 2014 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 COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_DATA_CHANNEL_HANDLER_H_
6 #define COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_DATA_CHANNEL_HANDLER_H_
8 #include "base/basictypes.h"
9 #include "components/test_runner/web_task.h"
10 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h"
11 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h"
12 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h"
13 #include "third_party/WebKit/public/platform/WebString.h"
15 namespace test_runner {
17 class WebTestDelegate;
19 class MockWebRTCDataChannelHandler : public blink::WebRTCDataChannelHandler {
20 public:
21 MockWebRTCDataChannelHandler(blink::WebString label,
22 const blink::WebRTCDataChannelInit& init,
23 WebTestDelegate* delegate);
25 // WebRTCDataChannelHandler related methods
26 virtual void setClient(
27 blink::WebRTCDataChannelHandlerClient* client) override;
28 virtual blink::WebString label() override;
29 virtual bool isReliable() override;
30 virtual bool ordered() const override;
31 virtual unsigned short maxRetransmitTime() const override;
32 virtual unsigned short maxRetransmits() const override;
33 virtual blink::WebString protocol() const override;
34 virtual bool negotiated() const override;
35 virtual unsigned short id() const override;
36 virtual blink::WebRTCDataChannelHandlerClient::ReadyState state() const
37 override;
38 virtual unsigned long bufferedAmount() override;
39 virtual bool sendStringData(const blink::WebString& data) override;
40 virtual bool sendRawData(const char* data, size_t size) override;
41 virtual void close() override;
43 // WebTask related methods
44 WebTaskList* mutable_task_list() { return &task_list_; }
46 private:
47 MockWebRTCDataChannelHandler();
49 blink::WebRTCDataChannelHandlerClient* client_;
50 blink::WebString label_;
51 blink::WebRTCDataChannelInit init_;
52 bool reliable_;
53 WebTaskList task_list_;
54 WebTestDelegate* delegate_;
56 DISALLOW_COPY_AND_ASSIGN(MockWebRTCDataChannelHandler);
59 } // namespace test_runner
61 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_DATA_CHANNEL_HANDLER_H_