tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mock_data_channel.h (2612B)


      1 /*
      2 *  Copyright 2020 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 
     11 #ifndef API_TEST_MOCK_DATA_CHANNEL_H_
     12 #define API_TEST_MOCK_DATA_CHANNEL_H_
     13 
     14 #include <cstdint>
     15 #include <optional>
     16 #include <string>
     17 
     18 #include "absl/functional/any_invocable.h"
     19 #include "api/data_channel_interface.h"
     20 #include "api/priority.h"
     21 #include "api/rtc_error.h"
     22 #include "api/scoped_refptr.h"
     23 #include "rtc_base/ref_counted_object.h"
     24 #include "test/gmock.h"
     25 
     26 namespace webrtc {
     27 
     28 class MockDataChannelInterface : public RefCountedObject<DataChannelInterface> {
     29 public:
     30  static scoped_refptr<MockDataChannelInterface> Create() {
     31    return scoped_refptr<MockDataChannelInterface>(
     32        new MockDataChannelInterface());
     33  }
     34 
     35  MOCK_METHOD(void,
     36              RegisterObserver,
     37              (DataChannelObserver * observer),
     38              (override));
     39  MOCK_METHOD(void, UnregisterObserver, (), (override));
     40  MOCK_METHOD(std::string, label, (), (const, override));
     41  MOCK_METHOD(bool, reliable, (), (const, override));
     42  MOCK_METHOD(bool, ordered, (), (const, override));
     43  MOCK_METHOD(std::optional<int>, maxRetransmitsOpt, (), (const, override));
     44  MOCK_METHOD(std::optional<int>, maxPacketLifeTime, (), (const, override));
     45  MOCK_METHOD(std::string, protocol, (), (const, override));
     46  MOCK_METHOD(bool, negotiated, (), (const, override));
     47  MOCK_METHOD(int, id, (), (const, override));
     48  MOCK_METHOD(PriorityValue, priority, (), (const, override));
     49  MOCK_METHOD(DataState, state, (), (const, override));
     50  MOCK_METHOD(RTCError, error, (), (const, override));
     51  MOCK_METHOD(uint32_t, messages_sent, (), (const, override));
     52  MOCK_METHOD(uint64_t, bytes_sent, (), (const, override));
     53  MOCK_METHOD(uint32_t, messages_received, (), (const, override));
     54  MOCK_METHOD(uint64_t, bytes_received, (), (const, override));
     55  MOCK_METHOD(uint64_t, buffered_amount, (), (const, override));
     56  MOCK_METHOD(void, Close, (), (override));
     57  MOCK_METHOD(bool, Send, (const DataBuffer& buffer), (override));
     58  MOCK_METHOD(void,
     59              SendAsync,
     60              (DataBuffer buffer,
     61               absl::AnyInvocable<void(RTCError) &&> on_complete),
     62              (override));
     63 
     64 protected:
     65  MockDataChannelInterface() = default;
     66 };
     67 
     68 }  // namespace webrtc
     69 
     70 #endif  // API_TEST_MOCK_DATA_CHANNEL_H_