blob: 3385ec2f75c0a19ef3ca3bd8cf92c1f6ec14f98e [file] [log] [blame]
hbosd565b732016-08-30 14:04:35 -07001/*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef PC_TEST_MOCK_DATA_CHANNEL_H_
12#define PC_TEST_MOCK_DATA_CHANNEL_H_
hbosd565b732016-08-30 14:04:35 -070013
Steve Anton36b29d12017-10-30 09:57:42 -070014#include <string>
15
Steve Anton10542f22019-01-11 09:11:00 -080016#include "pc/data_channel.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "test/gmock.h"
hbosd565b732016-08-30 14:04:35 -070018
19namespace webrtc {
20
21class MockDataChannel : public rtc::RefCountedObject<DataChannel> {
22 public:
hboscc555c52016-10-18 12:48:31 -070023 MockDataChannel(int id, DataState state)
Yves Gerey665174f2018-06-19 15:03:05 +020024 : MockDataChannel(id, "MockDataChannel", state, "udp", 0, 0, 0, 0) {}
25 MockDataChannel(int id,
26 const std::string& label,
27 DataState state,
28 const std::string& protocol,
29 uint32_t messages_sent,
30 uint64_t bytes_sent,
31 uint32_t messages_received,
32 uint64_t bytes_received)
33 : rtc::RefCountedObject<DataChannel>(nullptr, cricket::DCT_NONE, label) {
Mirko Bonadei6a489f22019-04-09 15:11:12 +020034 EXPECT_CALL(*this, id()).WillRepeatedly(::testing::Return(id));
35 EXPECT_CALL(*this, state()).WillRepeatedly(::testing::Return(state));
36 EXPECT_CALL(*this, protocol()).WillRepeatedly(::testing::Return(protocol));
Yves Gerey665174f2018-06-19 15:03:05 +020037 EXPECT_CALL(*this, messages_sent())
Mirko Bonadei6a489f22019-04-09 15:11:12 +020038 .WillRepeatedly(::testing::Return(messages_sent));
Yves Gerey665174f2018-06-19 15:03:05 +020039 EXPECT_CALL(*this, bytes_sent())
Mirko Bonadei6a489f22019-04-09 15:11:12 +020040 .WillRepeatedly(::testing::Return(bytes_sent));
Yves Gerey665174f2018-06-19 15:03:05 +020041 EXPECT_CALL(*this, messages_received())
Mirko Bonadei6a489f22019-04-09 15:11:12 +020042 .WillRepeatedly(::testing::Return(messages_received));
Yves Gerey665174f2018-06-19 15:03:05 +020043 EXPECT_CALL(*this, bytes_received())
Mirko Bonadei6a489f22019-04-09 15:11:12 +020044 .WillRepeatedly(::testing::Return(bytes_received));
hbosd565b732016-08-30 14:04:35 -070045 }
hboscc555c52016-10-18 12:48:31 -070046 MOCK_CONST_METHOD0(id, int());
hbosd565b732016-08-30 14:04:35 -070047 MOCK_CONST_METHOD0(state, DataState());
hbosdbb64d82016-12-21 01:57:46 -080048 MOCK_CONST_METHOD0(protocol, std::string());
hboscc555c52016-10-18 12:48:31 -070049 MOCK_CONST_METHOD0(messages_sent, uint32_t());
50 MOCK_CONST_METHOD0(bytes_sent, uint64_t());
51 MOCK_CONST_METHOD0(messages_received, uint32_t());
52 MOCK_CONST_METHOD0(bytes_received, uint64_t());
hbosd565b732016-08-30 14:04:35 -070053};
54
55} // namespace webrtc
56
Steve Anton10542f22019-01-11 09:11:00 -080057#endif // PC_TEST_MOCK_DATA_CHANNEL_H_