| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 public: | 91 public: |
| 92 explicit MockDataChannelObserver(webrtc::DataChannelInterface* channel) | 92 explicit MockDataChannelObserver(webrtc::DataChannelInterface* channel) |
| 93 : channel_(channel), received_message_count_(0) { | 93 : channel_(channel), received_message_count_(0) { |
| 94 channel_->RegisterObserver(this); | 94 channel_->RegisterObserver(this); |
| 95 state_ = channel_->state(); | 95 state_ = channel_->state(); |
| 96 } | 96 } |
| 97 virtual ~MockDataChannelObserver() { | 97 virtual ~MockDataChannelObserver() { |
| 98 channel_->UnregisterObserver(); | 98 channel_->UnregisterObserver(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 virtual void OnBufferedAmountChange(uint64 previous_amount) { } |
| 102 |
| 101 virtual void OnStateChange() { state_ = channel_->state(); } | 103 virtual void OnStateChange() { state_ = channel_->state(); } |
| 102 virtual void OnMessage(const DataBuffer& buffer) { | 104 virtual void OnMessage(const DataBuffer& buffer) { |
| 103 last_message_.assign(buffer.data.data<char>(), buffer.data.size()); | 105 last_message_.assign(buffer.data.data<char>(), buffer.data.size()); |
| 104 ++received_message_count_; | 106 ++received_message_count_; |
| 105 } | 107 } |
| 106 | 108 |
| 107 bool IsOpen() const { return state_ == DataChannelInterface::kOpen; } | 109 bool IsOpen() const { return state_ == DataChannelInterface::kOpen; } |
| 108 const std::string& last_message() const { return last_message_; } | 110 const std::string& last_message() const { return last_message_; } |
| 109 size_t received_message_count() const { return received_message_count_; } | 111 size_t received_message_count() const { return received_message_count_; } |
| 110 | 112 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 int bytes_sent; | 234 int bytes_sent; |
| 233 int available_receive_bandwidth; | 235 int available_receive_bandwidth; |
| 234 std::string dtls_cipher; | 236 std::string dtls_cipher; |
| 235 std::string srtp_cipher; | 237 std::string srtp_cipher; |
| 236 } stats_; | 238 } stats_; |
| 237 }; | 239 }; |
| 238 | 240 |
| 239 } // namespace webrtc | 241 } // namespace webrtc |
| 240 | 242 |
| 241 #endif // TALK_APP_WEBRTC_TEST_MOCKPEERCONNECTIONOBSERVERS_H_ | 243 #endif // TALK_APP_WEBRTC_TEST_MOCKPEERCONNECTIONOBSERVERS_H_ |
| OLD | NEW |