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.
4
5#ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCDATACHANNELHANDLER_H_
6#define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCDATACHANNELHANDLER_H_
7
8#include "base/basictypes.h"
9#include "content/shell/renderer/test_runner/web_task.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"
13
14namespace content {
15
16class WebTestDelegate;
17
18class MockWebRTCDataChannelHandler : public blink::WebRTCDataChannelHandler {
19 public:
20  MockWebRTCDataChannelHandler(blink::WebString label,
21                               const blink::WebRTCDataChannelInit& init,
22                               WebTestDelegate* delegate);
23
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;
39
40  // WebTask related methods
41  WebTaskList* mutable_task_list() { return &task_list_; }
42
43 private:
44  MockWebRTCDataChannelHandler();
45
46  blink::WebRTCDataChannelHandlerClient* client_;
47  blink::WebString label_;
48  blink::WebRTCDataChannelInit init_;
49  bool reliable_;
50  WebTaskList task_list_;
51  WebTestDelegate* delegate_;
52
53  DISALLOW_COPY_AND_ASSIGN(MockWebRTCDataChannelHandler);
54};
55
56}  // namespace content
57
58#endif  // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCDATACHANNELHANDLER_H_
59