blob: 20a4da664a27abfb564e3b4a8d4fb0a522333b2a [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef PC_TEST_MOCK_DATACHANNEL_H_
12#define PC_TEST_MOCK_DATACHANNEL_H_
hbosd565b732016-08-30 14:04:35 -070013
Steve Anton36b29d12017-10-30 09:57:42 -070014#include <string>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "pc/datachannel.h"
17#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)
hbosdbb64d82016-12-21 01:57:46 -080024 : MockDataChannel(id, "MockDataChannel", state, "udp", 0, 0, 0, 0) {
hboscc555c52016-10-18 12:48:31 -070025 }
26 MockDataChannel(
27 int id,
hbosdbb64d82016-12-21 01:57:46 -080028 const std::string& label,
hboscc555c52016-10-18 12:48:31 -070029 DataState state,
hbosdbb64d82016-12-21 01:57:46 -080030 const std::string& protocol,
hboscc555c52016-10-18 12:48:31 -070031 uint32_t messages_sent,
32 uint64_t bytes_sent,
33 uint32_t messages_received,
34 uint64_t bytes_received)
hbosd565b732016-08-30 14:04:35 -070035 : rtc::RefCountedObject<DataChannel>(
hbosdbb64d82016-12-21 01:57:46 -080036 nullptr, cricket::DCT_NONE, label) {
hboscc555c52016-10-18 12:48:31 -070037 EXPECT_CALL(*this, id()).WillRepeatedly(testing::Return(id));
hbosd565b732016-08-30 14:04:35 -070038 EXPECT_CALL(*this, state()).WillRepeatedly(testing::Return(state));
hbosdbb64d82016-12-21 01:57:46 -080039 EXPECT_CALL(*this, protocol()).WillRepeatedly(testing::Return(protocol));
hboscc555c52016-10-18 12:48:31 -070040 EXPECT_CALL(*this, messages_sent()).WillRepeatedly(
41 testing::Return(messages_sent));
42 EXPECT_CALL(*this, bytes_sent()).WillRepeatedly(
43 testing::Return(bytes_sent));
44 EXPECT_CALL(*this, messages_received()).WillRepeatedly(
45 testing::Return(messages_received));
46 EXPECT_CALL(*this, bytes_received()).WillRepeatedly(
47 testing::Return(bytes_received));
hbosd565b732016-08-30 14:04:35 -070048 }
hboscc555c52016-10-18 12:48:31 -070049 MOCK_CONST_METHOD0(id, int());
hbosd565b732016-08-30 14:04:35 -070050 MOCK_CONST_METHOD0(state, DataState());
hbosdbb64d82016-12-21 01:57:46 -080051 MOCK_CONST_METHOD0(protocol, std::string());
hboscc555c52016-10-18 12:48:31 -070052 MOCK_CONST_METHOD0(messages_sent, uint32_t());
53 MOCK_CONST_METHOD0(bytes_sent, uint64_t());
54 MOCK_CONST_METHOD0(messages_received, uint32_t());
55 MOCK_CONST_METHOD0(bytes_received, uint64_t());
hbosd565b732016-08-30 14:04:35 -070056};
57
58} // namespace webrtc
59
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020060#endif // PC_TEST_MOCK_DATACHANNEL_H_