Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / renderer / media / mock_data_channel_impl.h
blob45e3b2a9765b64a384c06e52c10e8825502da293
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 "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h"
12 namespace content {
14 class MockDataChannel : public webrtc::DataChannelInterface {
15 public:
16 MockDataChannel(const std::string& label,
17 const webrtc::DataChannelInit* config);
19 void RegisterObserver(webrtc::DataChannelObserver* observer) override;
20 void UnregisterObserver() override;
21 std::string label() const override;
22 bool reliable() const override;
23 bool ordered() const override;
24 unsigned short maxRetransmitTime() const override;
25 unsigned short maxRetransmits() const override;
26 std::string protocol() const override;
27 bool negotiated() const override;
28 int id() const override;
29 DataState state() const override;
30 uint64 buffered_amount() const override;
31 void Close() override;
32 bool Send(const webrtc::DataBuffer& buffer) override;
34 // For testing.
35 void changeState(DataState state);
37 protected:
38 ~MockDataChannel() override;
40 private:
41 std::string label_;
42 bool reliable_;
43 webrtc::DataChannelInterface::DataState state_;
44 webrtc::DataChannelInit config_;
45 webrtc::DataChannelObserver* observer_;
47 DISALLOW_COPY_AND_ASSIGN(MockDataChannel);
50 } // namespace content
52 #endif // CONTENT_RENDERER_MEDIA_MOCK_DATA_CHANNEL_IMPL_H_