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 CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCDATACHANNELHANDLER_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCDATACHANNELHANDLER_H_
8 #include "base/basictypes.h"
9 #include "content/shell/renderer/test_runner/WebTask.h"
10 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h"
11 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h"
12 #include "third_party/WebKit/public/platform/WebString.h"
16 class WebTestDelegate;
18 class MockWebRTCDataChannelHandler : public blink::WebRTCDataChannelHandler {
20 MockWebRTCDataChannelHandler(blink::WebString label,
21 const blink::WebRTCDataChannelInit& init,
22 WebTestDelegate* delegate);
24 // WebRTCDataChannelHandler related methods
25 virtual void setClient(
26 blink::WebRTCDataChannelHandlerClient* client) OVERRIDE;
27 virtual blink::WebString label() OVERRIDE;
28 virtual bool isReliable() OVERRIDE;
29 virtual bool ordered() const OVERRIDE;
30 virtual unsigned short maxRetransmitTime() const OVERRIDE;
31 virtual unsigned short maxRetransmits() const OVERRIDE;
32 virtual blink::WebString protocol() const OVERRIDE;
33 virtual bool negotiated() const OVERRIDE;
34 virtual unsigned short id() const OVERRIDE;
35 virtual unsigned long bufferedAmount() OVERRIDE;
36 virtual bool sendStringData(const blink::WebString& data) OVERRIDE;
37 virtual bool sendRawData(const char* data, size_t size) OVERRIDE;
38 virtual void close() OVERRIDE;
40 // WebTask related methods
41 WebTaskList* mutable_task_list() { return &task_list_; }
44 MockWebRTCDataChannelHandler();
46 blink::WebRTCDataChannelHandlerClient* client_;
47 blink::WebString label_;
48 blink::WebRTCDataChannelInit init_;
50 WebTaskList task_list_;
51 WebTestDelegate* delegate_;
53 DISALLOW_COPY_AND_ASSIGN(MockWebRTCDataChannelHandler);
56 } // namespace content
58 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCDATACHANNELHANDLER_H_