Add override declarations to PeerConnectionObserver subclasses, and delete obsolete methods.

BUG=None

Review-Url: https://codereview.webrtc.org/2660223002
Cr-Commit-Position: refs/heads/master@{#16374}
This commit is contained in:
nisse 2017-01-31 03:34:01 -08:00 committed by Commit bot
parent 1783f169d9
commit 63b14b7d15
4 changed files with 44 additions and 68 deletions

View File

@ -84,37 +84,37 @@ class Conductor
// PeerConnectionClientObserver implementation.
//
virtual void OnSignedIn();
void OnSignedIn() override;
virtual void OnDisconnected();
void OnDisconnected() override;
virtual void OnPeerConnected(int id, const std::string& name);
void OnPeerConnected(int id, const std::string& name) override;
virtual void OnPeerDisconnected(int id);
void OnPeerDisconnected(int id) override;
virtual void OnMessageFromPeer(int peer_id, const std::string& message);
void OnMessageFromPeer(int peer_id, const std::string& message) override;
virtual void OnMessageSent(int err);
void OnMessageSent(int err) override;
virtual void OnServerConnectionFailure();
void OnServerConnectionFailure() override;
//
// MainWndCallback implementation.
//
virtual void StartLogin(const std::string& server, int port);
void StartLogin(const std::string& server, int port) override;
virtual void DisconnectFromServer();
void DisconnectFromServer() override;
virtual void ConnectToPeer(int peer_id);
void ConnectToPeer(int peer_id) override;
virtual void DisconnectFromCurrentPeer();
void DisconnectFromCurrentPeer() override;
virtual void UIThreadCallback(int msg_id, void* data);
void UIThreadCallback(int msg_id, void* data) override;
// CreateSessionDescriptionObserver implementation.
virtual void OnSuccess(webrtc::SessionDescriptionInterface* desc);
virtual void OnFailure(const std::string& error);
void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
void OnFailure(const std::string& error) override;
protected:
// Send a message to the remote peer.

View File

@ -71,21 +71,20 @@ class NullPeerConnectionObserver : public PeerConnectionObserver {
using PeerConnectionObserver::OnDataChannel;
virtual ~NullPeerConnectionObserver() = default;
virtual void OnMessage(const std::string& msg) {}
virtual void OnSignalingMessage(const std::string& msg) {}
virtual void OnSignalingChange(
PeerConnectionInterface::SignalingState new_state) {}
virtual void OnAddStream(rtc::scoped_refptr<MediaStreamInterface> stream) {}
virtual void OnRemoveStream(rtc::scoped_refptr<MediaStreamInterface> stream) {
}
virtual void OnDataChannel(
rtc::scoped_refptr<DataChannelInterface> data_channel) {}
virtual void OnRenegotiationNeeded() {}
virtual void OnIceConnectionChange(
PeerConnectionInterface::IceConnectionState new_state) {}
virtual void OnIceGatheringChange(
PeerConnectionInterface::IceGatheringState new_state) {}
virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) {}
void OnSignalingChange(
PeerConnectionInterface::SignalingState new_state) override {}
void OnAddStream(rtc::scoped_refptr<MediaStreamInterface> stream) override {}
void OnRemoveStream(
rtc::scoped_refptr<MediaStreamInterface> stream) override {}
void OnDataChannel(
rtc::scoped_refptr<DataChannelInterface> data_channel) override {}
void OnRenegotiationNeeded() override {}
void OnIceConnectionChange(
PeerConnectionInterface::IceConnectionState new_state) override {}
void OnIceGatheringChange(
PeerConnectionInterface::IceGatheringState new_state) override {}
void OnIceCandidate(
const webrtc::IceCandidateInterface* candidate) override {}
};
} // namespace

View File

@ -547,26 +547,6 @@ class MockPeerConnectionObserver : public PeerConnectionObserver {
EXPECT_EQ(pc_->signaling_state(), new_state);
state_ = new_state;
}
// TODO(bemasc): Remove this once callers transition to OnIceGatheringChange.
virtual void OnStateChange(StateType state_changed) {
if (pc_.get() == NULL)
return;
switch (state_changed) {
case kSignalingState:
// OnSignalingChange and OnStateChange(kSignalingState) should always
// be called approximately simultaneously. To ease testing, we require
// that they always be called in that order. This check verifies
// that OnSignalingChange has just been called.
EXPECT_EQ(pc_->signaling_state(), state_);
break;
case kIceState:
ADD_FAILURE();
break;
default:
ADD_FAILURE();
break;
}
}
MediaStreamInterface* RemoteStream(const std::string& label) {
return remote_streams_->find(label);

View File

@ -50,27 +50,24 @@ class PeerConnectionTestWrapper
const webrtc::DataChannelInit& init);
// Implements PeerConnectionObserver.
virtual void OnSignalingChange(
webrtc::PeerConnectionInterface::SignalingState new_state) {}
virtual void OnStateChange(
webrtc::PeerConnectionObserver::StateType state_changed) {}
virtual void OnAddStream(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream);
virtual void OnRemoveStream(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {}
virtual void OnDataChannel(
rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel);
virtual void OnRenegotiationNeeded() {}
virtual void OnIceConnectionChange(
webrtc::PeerConnectionInterface::IceConnectionState new_state) {}
virtual void OnIceGatheringChange(
webrtc::PeerConnectionInterface::IceGatheringState new_state) {}
virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate);
virtual void OnIceComplete() {}
void OnSignalingChange(
webrtc::PeerConnectionInterface::SignalingState new_state) override {}
void OnAddStream(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override;
void OnRemoveStream(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override {}
void OnDataChannel(
rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override ;
void OnRenegotiationNeeded() override {}
void OnIceConnectionChange(
webrtc::PeerConnectionInterface::IceConnectionState new_state) override {}
void OnIceGatheringChange(
webrtc::PeerConnectionInterface::IceGatheringState new_state) override {}
void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override;
// Implements CreateSessionDescriptionObserver.
virtual void OnSuccess(webrtc::SessionDescriptionInterface* desc);
virtual void OnFailure(const std::string& error) {}
void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
void OnFailure(const std::string& error) override {}
void CreateOffer(const webrtc::MediaConstraintsInterface* constraints);
void CreateAnswer(const webrtc::MediaConstraintsInterface* constraints);