Home | History | Annotate | Download | only in test_runner
      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/TestCommon.h"
     10 #include "content/shell/renderer/test_runner/WebTask.h"
     11 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h"
     12 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h"
     13 #include "third_party/WebKit/public/platform/WebString.h"
     14 
     15 namespace content {
     16 
     17 class WebTestDelegate;
     18 
     19 class MockWebRTCDataChannelHandler : public blink::WebRTCDataChannelHandler {
     20  public:
     21   MockWebRTCDataChannelHandler(blink::WebString label,
     22                                const blink::WebRTCDataChannelInit& init,
     23                                WebTestDelegate* delegate);
     24 
     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 unsigned long bufferedAmount() OVERRIDE;
     37   virtual bool sendStringData(const blink::WebString& data) OVERRIDE;
     38   virtual bool sendRawData(const char* data, size_t size) OVERRIDE;
     39   virtual void close() OVERRIDE;
     40 
     41   // WebTask related methods
     42   WebTaskList* mutable_task_list() { return &task_list_; }
     43 
     44  private:
     45   MockWebRTCDataChannelHandler();
     46 
     47   blink::WebRTCDataChannelHandlerClient* client_;
     48   blink::WebString label_;
     49   blink::WebRTCDataChannelInit init_;
     50   bool reliable_;
     51   WebTaskList task_list_;
     52   WebTestDelegate* delegate_;
     53 
     54   DISALLOW_COPY_AND_ASSIGN(MockWebRTCDataChannelHandler);
     55 };
     56 
     57 }  // namespace content
     58 
     59 #endif  // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCDATACHANNELHANDLER_H_
     60