Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / renderer / media / mock_data_channel_impl.h
blobcc3f38582b1be7ed66627daff159b91df6d6ec07
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_RENDERER_MEDIA_MOCK_DATA_CHANNEL_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_MOCK_DATA_CHANNEL_IMPL_H_
8 #include <string>
10 #include "base/macros.h"
11 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h"
13 namespace content {
15 class MockDataChannel : public webrtc::DataChannelInterface {
16 public:
17 MockDataChannel(const std::string& label,
18 const webrtc::DataChannelInit* config);
20 void RegisterObserver(webrtc::DataChannelObserver* observer) override;
21 void UnregisterObserver() override;
22 std::string label() const override;
23 bool reliable() const override;
24 bool ordered() const override;
25 unsigned short maxRetransmitTime() const override;
26 unsigned short maxRetransmits() const override;
27 std::string protocol() const override;
28 bool negotiated() const override;
29 int id() const override;
30 DataState state() const override;
31 uint64 buffered_amount() const override;
32 void Close() override;
33 bool Send(const webrtc::DataBuffer& buffer) override;
35 // For testing.
36 void changeState(DataState state);
38 protected:
39 ~MockDataChannel() override;
41 private:
42 std::string label_;
43 bool reliable_;
44 webrtc::DataChannelInterface::DataState state_;
45 webrtc::DataChannelInit config_;
46 webrtc::DataChannelObserver* observer_;
48 DISALLOW_COPY_AND_ASSIGN(MockDataChannel);
51 } // namespace content
53 #endif // CONTENT_RENDERER_MEDIA_MOCK_DATA_CHANNEL_IMPL_H_