зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1272197 - Part 5, rename callback functions in nsIPresentationControlChannel.idl. r=junior
MozReview-Commit-ID: cvavmuUxeX
This commit is contained in:
Родитель
0d76940df2
Коммит
387368f47d
|
@ -221,8 +221,8 @@ PresentationTransportBuilder.prototype = {
|
|||
this._peerConnection.addIceCandidate(candidate).catch(e => this._reportError(e));
|
||||
},
|
||||
|
||||
notifyClosed: function(aReason) {
|
||||
log("notifyClosed reason: " + aReason);
|
||||
notifyDisconnected: function(aReason) {
|
||||
log("notifyDisconnected reason: " + aReason);
|
||||
|
||||
if (aReason != Cr.NS_OK) {
|
||||
this._cleanup(aReason);
|
||||
|
|
|
@ -478,7 +478,7 @@ PresentationSessionInfo::Close(nsresult reason)
|
|||
* 4 is not guaranteed.)
|
||||
* 1. |Init| is called to open a socket |mServerSocket| for data transport
|
||||
* channel.
|
||||
* 2. |NotifyOpened| of |nsIPresentationControlChannelListener| is called to
|
||||
* 2. |NotifyConnected| of |nsIPresentationControlChannelListener| is called to
|
||||
* indicate the control channel is ready to use. Then send the offer to the
|
||||
* receiver via the control channel.
|
||||
* 3.1 |OnSocketAccepted| of |nsIServerSocketListener| is called to indicate the
|
||||
|
@ -688,7 +688,7 @@ PresentationControllingInfo::OnAnswer(nsIPresentationChannelDescription* aDescri
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationControllingInfo::NotifyOpened()
|
||||
PresentationControllingInfo::NotifyConnected()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -747,7 +747,7 @@ PresentationControllingInfo::NotifyOpened()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationControllingInfo::NotifyClosed(nsresult aReason)
|
||||
PresentationControllingInfo::NotifyDisconnected(nsresult aReason)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -755,7 +755,7 @@ PresentationControllingInfo::NotifyClosed(nsresult aReason)
|
|||
nsCOMPtr<nsIPresentationDataChannelSessionTransportBuilder>
|
||||
builder = do_QueryInterface(mBuilder);
|
||||
if (builder) {
|
||||
NS_WARN_IF(NS_FAILED(builder->NotifyClosed(aReason)));
|
||||
NS_WARN_IF(NS_FAILED(builder->NotifyDisconnected(aReason)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1137,14 +1137,14 @@ PresentationPresentingInfo::OnIceCandidate(const nsAString& aCandidate)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationPresentingInfo::NotifyOpened()
|
||||
PresentationPresentingInfo::NotifyConnected()
|
||||
{
|
||||
// Do nothing.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationPresentingInfo::NotifyClosed(nsresult aReason)
|
||||
PresentationPresentingInfo::NotifyDisconnected(nsresult aReason)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ PresentationPresentingInfo::NotifyClosed(nsresult aReason)
|
|||
nsCOMPtr<nsIPresentationDataChannelSessionTransportBuilder>
|
||||
builder = do_QueryInterface(mBuilder);
|
||||
if (builder) {
|
||||
NS_WARN_IF(NS_FAILED(builder->NotifyClosed(aReason)));
|
||||
NS_WARN_IF(NS_FAILED(builder->NotifyDisconnected(aReason)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,16 +54,16 @@ interface nsIPresentationControlChannelListener: nsISupports
|
|||
void onIceCandidate(in DOMString candidate);
|
||||
|
||||
/*
|
||||
* The callback for notifying channel opened. This should be async called
|
||||
* The callback for notifying channel connected. This should be async called
|
||||
* after nsIPresentationDevice::establishControlChannel.
|
||||
*/
|
||||
void notifyOpened();
|
||||
void notifyConnected();
|
||||
|
||||
/*
|
||||
* The callback for notifying channel closed.
|
||||
* The callback for notifying channel disconnected.
|
||||
* @param reason The reason of channel close, NS_OK represents normal close.
|
||||
*/
|
||||
void notifyClosed(in nsresult reason);
|
||||
void notifyDisconnected(in nsresult reason);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -55,7 +55,7 @@ interface nsIPresentationDataChannelSessionTransportBuilder : nsIPresentationSes
|
|||
/**
|
||||
* The following creation function will trigger |listener.onSessionTransport|
|
||||
* if the session transport is successfully built, |listener.onError| if some
|
||||
* error occurs during creating session transport. The |notifyOpened| of
|
||||
* error occurs during creating session transport. The |notifyConnected| of
|
||||
* |aControlChannel| should be called before calling
|
||||
* |buildDataChannelTransport|.
|
||||
*/
|
||||
|
@ -67,5 +67,5 @@ interface nsIPresentationDataChannelSessionTransportBuilder : nsIPresentationSes
|
|||
void onOffer(in nsIPresentationChannelDescription offer);
|
||||
void onAnswer(in nsIPresentationChannelDescription answer);
|
||||
void onIceCandidate(in DOMString candidate);
|
||||
void notifyClosed(in nsresult reason);
|
||||
void notifyDisconnected(in nsresult reason);
|
||||
};
|
||||
|
|
|
@ -89,7 +89,7 @@ PresentationBuilderParent::OnAnswer(nsIPresentationChannelDescription* aDescript
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationBuilderParent::NotifyClosed(nsresult aReason)
|
||||
PresentationBuilderParent::NotifyDisconnected(nsresult aReason)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ var handlers = [
|
|||
break;
|
||||
case CommandType.DISCONNECT:
|
||||
stateMachine.state = State.CLOSED;
|
||||
stateMachine._notifyClosed(command.reason);
|
||||
stateMachine._notifyDisconnected(command.reason);
|
||||
break;
|
||||
default:
|
||||
debug("unexpected command: " + JSON.stringify(command));
|
||||
|
@ -45,7 +45,7 @@ var handlers = [
|
|||
switch (command.type) {
|
||||
case CommandType.DISCONNECT:
|
||||
stateMachine.state = State.CLOSED;
|
||||
stateMachine._notifyClosed(command.reason);
|
||||
stateMachine._notifyDisconnected(command.reason);
|
||||
break;
|
||||
case CommandType.LAUNCH_ACK:
|
||||
stateMachine._notifyLaunch(command.presentationId);
|
||||
|
@ -129,7 +129,7 @@ ControllerStateMachine.prototype = {
|
|||
case State.CONNECTED:
|
||||
if (isByRemote) {
|
||||
this.state = State.CLOSED;
|
||||
this._notifyClosed(reason);
|
||||
this._notifyDisconnected(reason);
|
||||
} else {
|
||||
this._sendCommand({
|
||||
type: CommandType.DISCONNECT,
|
||||
|
@ -146,7 +146,7 @@ ControllerStateMachine.prototype = {
|
|||
reason = this._closeReason;
|
||||
delete this._closeReason;
|
||||
}
|
||||
this._notifyClosed(reason);
|
||||
this._notifyDisconnected(reason);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -164,8 +164,8 @@ ControllerStateMachine.prototype = {
|
|||
this._channel.notifyDeviceConnected();
|
||||
},
|
||||
|
||||
_notifyClosed: function _notifyClosed(reason) {
|
||||
this._channel.notifyClosed(reason);
|
||||
_notifyDisconnected: function _notifyDisconnected(reason) {
|
||||
this._channel.notifyDisconnected(reason);
|
||||
},
|
||||
|
||||
_notifyLaunch: function _notifyLaunch(presentationId) {
|
||||
|
|
|
@ -220,7 +220,7 @@ LegacyTCPControlChannel.prototype = {
|
|||
|
||||
this._sendMessage(msg, function(e) {
|
||||
this.disconnect();
|
||||
this._notifyClosed(e.result);
|
||||
this._notifyDisconnected(e.result);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -280,7 +280,7 @@ LegacyTCPControlChannel.prototype = {
|
|||
} catch (e) {
|
||||
DEBUG && log("LegacyTCPControlChannel - onInputStreamReady error: " + e.name); //jshint ignore:line
|
||||
// NS_ERROR_CONNECTION_REFUSED
|
||||
this._listener.notifyClosed(e.result);
|
||||
this._listener.notifyDisconnected(e.result);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -295,7 +295,7 @@ LegacyTCPControlChannel.prototype = {
|
|||
this._createInputStreamPump();
|
||||
}
|
||||
|
||||
this._notifyOpened();
|
||||
this._notifyConnected();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -308,7 +308,7 @@ LegacyTCPControlChannel.prototype = {
|
|||
onStopRequest: function(aRequest, aContext, aStatus) {
|
||||
DEBUG && log("LegacyTCPControlChannel - onStopRequest: " + aStatus); //jshint ignore:line
|
||||
this.disconnect(aStatus);
|
||||
this._notifyClosed(aStatus);
|
||||
this._notifyDisconnected(aStatus);
|
||||
},
|
||||
|
||||
// nsIStreamListener (Triggered by nsIInputStreamPump.asyncRead)
|
||||
|
@ -375,7 +375,7 @@ LegacyTCPControlChannel.prototype = {
|
|||
if (this._pendingOpen) {
|
||||
this._pendingOpen = false;
|
||||
DEBUG && log("LegacyTCPControlChannel - notify pending opened"); //jshint ignore:line
|
||||
this._listener.notifyOpened();
|
||||
this._listener.notifyConnected();
|
||||
}
|
||||
|
||||
if (this._pendingAnswer) {
|
||||
|
@ -388,7 +388,7 @@ LegacyTCPControlChannel.prototype = {
|
|||
|
||||
if (this._pendingClose) {
|
||||
DEBUG && log("LegacyTCPControlChannel - notify pending closed"); //jshint ignore:line
|
||||
this._notifyClosed(this._pendingCloseReason);
|
||||
this._notifyDisconnected(this._pendingCloseReason);
|
||||
this._pendingClose = null;
|
||||
}
|
||||
},
|
||||
|
@ -409,7 +409,7 @@ LegacyTCPControlChannel.prototype = {
|
|||
this._listener.onAnswer(new ChannelDescription(aAnswer));
|
||||
},
|
||||
|
||||
_notifyOpened: function() {
|
||||
_notifyConnected: function() {
|
||||
this._connected = true;
|
||||
this._pendingClose = false;
|
||||
this._pendingCloseReason = Cr.NS_OK;
|
||||
|
@ -420,10 +420,10 @@ LegacyTCPControlChannel.prototype = {
|
|||
}
|
||||
|
||||
DEBUG && log("LegacyTCPControlChannel - notify opened"); //jshint ignore:line
|
||||
this._listener.notifyOpened();
|
||||
this._listener.notifyConnected();
|
||||
},
|
||||
|
||||
_notifyClosed: function(aReason) {
|
||||
_notifyDisconnected: function(aReason) {
|
||||
this._connected = false;
|
||||
this._pendingOpen = false;
|
||||
this._pendingAnswer = null;
|
||||
|
@ -440,7 +440,7 @@ LegacyTCPControlChannel.prototype = {
|
|||
}
|
||||
|
||||
DEBUG && log("LegacyTCPControlChannel - notify closed"); //jshint ignore:line
|
||||
this._listener.notifyClosed(aReason);
|
||||
this._listener.notifyDisconnected(aReason);
|
||||
},
|
||||
|
||||
disconnect: function(aReason) {
|
||||
|
|
|
@ -418,7 +418,7 @@ TCPControlChannel.prototype = {
|
|||
} catch (e) {
|
||||
DEBUG && log("TCPControlChannel - onInputStreamReady error: " + e.name); // jshint ignore:line
|
||||
// NS_ERROR_CONNECTION_REFUSED
|
||||
this._listener.notifyClosed(e.result);
|
||||
this._listener.notifyDisconnected(e.result);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -501,7 +501,7 @@ TCPControlChannel.prototype = {
|
|||
if (this._pendingOpen) {
|
||||
this._pendingOpen = false;
|
||||
DEBUG && log("TCPControlChannel - notify pending opened"); // jshint ignore:line
|
||||
this._listener.notifyOpened();
|
||||
this._listener.notifyConnected();
|
||||
}
|
||||
|
||||
if (this._pendingOffer) {
|
||||
|
@ -522,7 +522,7 @@ TCPControlChannel.prototype = {
|
|||
|
||||
if (this._pendingClose) {
|
||||
DEBUG && log("TCPControlChannel - notify pending closed"); // jshint ignore:line
|
||||
this._notifyClosed(this._pendingCloseReason);
|
||||
this._notifyDisconnected(this._pendingCloseReason);
|
||||
this._pendingClose = null;
|
||||
}
|
||||
},
|
||||
|
@ -557,7 +557,7 @@ TCPControlChannel.prototype = {
|
|||
this._listener.onAnswer(new ChannelDescription(aAnswer));
|
||||
},
|
||||
|
||||
_notifyOpened: function() {
|
||||
_notifyConnected: function() {
|
||||
this._connected = true;
|
||||
this._pendingClose = false;
|
||||
this._pendingCloseReason = Cr.NS_OK;
|
||||
|
@ -569,10 +569,10 @@ TCPControlChannel.prototype = {
|
|||
|
||||
DEBUG && log("TCPControlChannel - notify opened with role: " +
|
||||
this._direction); // jshint ignore:line
|
||||
this._listener.notifyOpened();
|
||||
this._listener.notifyConnected();
|
||||
},
|
||||
|
||||
_notifyClosed: function(aReason) {
|
||||
_notifyDisconnected: function(aReason) {
|
||||
this._connected = false;
|
||||
this._pendingOpen = false;
|
||||
this._pendingOffer = null;
|
||||
|
@ -591,7 +591,7 @@ TCPControlChannel.prototype = {
|
|||
|
||||
DEBUG && log("TCPControlChannel - notify closed with role: " +
|
||||
this._direction); // jshint ignore:line
|
||||
this._listener.notifyClosed(aReason);
|
||||
this._listener.notifyDisconnected(aReason);
|
||||
},
|
||||
|
||||
_closeTransport: function() {
|
||||
|
@ -630,11 +630,11 @@ TCPControlChannel.prototype = {
|
|||
this._deviceInfo.id = deviceId;
|
||||
break;
|
||||
}
|
||||
this._notifyOpened();
|
||||
this._notifyConnected();
|
||||
},
|
||||
|
||||
notifyClosed: function(reason) {
|
||||
this._notifyClosed(reason);
|
||||
notifyDisconnected: function(reason) {
|
||||
this._notifyDisconnected(reason);
|
||||
this._closeTransport();
|
||||
this._connected = false;
|
||||
},
|
||||
|
|
|
@ -36,7 +36,7 @@ var handlers = [
|
|||
break;
|
||||
case CommandType.DISCONNECT:
|
||||
stateMachine.state = State.CLOSED;
|
||||
stateMachine._notifyClosed(command.reason);
|
||||
stateMachine._notifyDisconnected(command.reason);
|
||||
break;
|
||||
default:
|
||||
debug("unexpected command: " + JSON.stringify(command));
|
||||
|
@ -48,7 +48,7 @@ var handlers = [
|
|||
switch (command.type) {
|
||||
case CommandType.DISCONNECT:
|
||||
stateMachine.state = State.CLOSED;
|
||||
stateMachine._notifyClosed(command.reason);
|
||||
stateMachine._notifyDisconnected(command.reason);
|
||||
break;
|
||||
case CommandType.LAUNCH:
|
||||
stateMachine._notifyLaunch(command.presentationId,
|
||||
|
@ -127,7 +127,7 @@ ReceiverStateMachine.prototype = {
|
|||
case State.CONNECTED:
|
||||
if (isByRemote) {
|
||||
this.state = State.CLOSED;
|
||||
this._notifyClosed(reason);
|
||||
this._notifyDisconnected(reason);
|
||||
} else {
|
||||
this._sendCommand({
|
||||
type: CommandType.DISCONNECT,
|
||||
|
@ -144,7 +144,7 @@ ReceiverStateMachine.prototype = {
|
|||
reason = this._closeReason;
|
||||
delete this._closeReason;
|
||||
}
|
||||
this._notifyClosed(reason);
|
||||
this._notifyDisconnected(reason);
|
||||
} else {
|
||||
// do nothing and wait for remote channel closed.
|
||||
}
|
||||
|
@ -163,8 +163,8 @@ ReceiverStateMachine.prototype = {
|
|||
this._channel.notifyDeviceConnected(deviceName);
|
||||
},
|
||||
|
||||
_notifyClosed: function _notifyClosed(reason) {
|
||||
this._channel.notifyClosed(reason);
|
||||
_notifyDisconnected: function _notifyDisconnected(reason) {
|
||||
this._channel.notifyDisconnected(reason);
|
||||
},
|
||||
|
||||
_notifyLaunch: function _notifyLaunch(presentationId, url) {
|
||||
|
|
|
@ -145,7 +145,7 @@ const mockedControlChannel = {
|
|||
},
|
||||
disconnect: function(reason) {
|
||||
sendAsyncMessage('control-channel-closed', reason);
|
||||
this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).notifyClosed(reason);
|
||||
this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).notifyDisconnected(reason);
|
||||
},
|
||||
simulateReceiverReady: function() {
|
||||
this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).notifyReceiverReady();
|
||||
|
@ -158,9 +158,9 @@ const mockedControlChannel = {
|
|||
sendAsyncMessage('answer-received');
|
||||
this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).onAnswer(mockedChannelDescription);
|
||||
},
|
||||
simulateNotifyOpened: function() {
|
||||
simulateNotifyConnected: function() {
|
||||
sendAsyncMessage('control-channel-opened');
|
||||
this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).notifyOpened();
|
||||
this._listener.QueryInterface(Ci.nsIPresentationControlChannelListener).notifyConnected();
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -405,7 +405,7 @@ addMessageListener('trigger-incoming-transport', function() {
|
|||
});
|
||||
|
||||
addMessageListener('trigger-control-channel-open', function(reason) {
|
||||
mockedControlChannel.simulateNotifyOpened();
|
||||
mockedControlChannel.simulateNotifyConnected();
|
||||
});
|
||||
|
||||
addMessageListener('trigger-control-channel-close', function(reason) {
|
||||
|
|
|
@ -169,11 +169,11 @@ const mockControlChannelOfSender = {
|
|||
get listener() {
|
||||
return this._listener;
|
||||
},
|
||||
notifyOpened: function() {
|
||||
// send offer after notifyOpened immediately
|
||||
notifyConnected: function() {
|
||||
// send offer after notifyConnected immediately
|
||||
this._listener
|
||||
.QueryInterface(Ci.nsIPresentationControlChannelListener)
|
||||
.notifyOpened();
|
||||
.notifyConnected();
|
||||
},
|
||||
sendOffer: function(offer) {
|
||||
sendAsyncMessage('offer-sent');
|
||||
|
@ -189,7 +189,7 @@ const mockControlChannelOfSender = {
|
|||
disconnect: function(reason) {
|
||||
this._listener
|
||||
.QueryInterface(Ci.nsIPresentationControlChannelListener)
|
||||
.notifyClosed(reason);
|
||||
.notifyDisconnected(reason);
|
||||
mockControlChannelOfReceiver.disconnect();
|
||||
}
|
||||
};
|
||||
|
@ -208,13 +208,13 @@ const mockControlChannelOfReceiver = {
|
|||
|
||||
if (this._pendingOpened) {
|
||||
this._pendingOpened = false;
|
||||
this.notifyOpened();
|
||||
this.notifyConnected();
|
||||
}
|
||||
},
|
||||
get listener() {
|
||||
return this._listener;
|
||||
},
|
||||
notifyOpened: function() {
|
||||
notifyConnected: function() {
|
||||
// do nothing
|
||||
if (!this._listener) {
|
||||
this._pendingOpened = true;
|
||||
|
@ -222,7 +222,7 @@ const mockControlChannelOfReceiver = {
|
|||
}
|
||||
this._listener
|
||||
.QueryInterface(Ci.nsIPresentationControlChannelListener)
|
||||
.notifyOpened();
|
||||
.notifyConnected();
|
||||
},
|
||||
onOffer: function(offer) {
|
||||
this._listener
|
||||
|
@ -238,7 +238,7 @@ const mockControlChannelOfReceiver = {
|
|||
disconnect: function(reason) {
|
||||
this._listener
|
||||
.QueryInterface(Ci.nsIPresentationControlChannelListener)
|
||||
.notifyClosed(reason);
|
||||
.notifyDisconnected(reason);
|
||||
sendAsyncMessage('control-channel-receiver-closed', reason);
|
||||
}
|
||||
};
|
||||
|
@ -369,8 +369,8 @@ function initMockAndListener() {
|
|||
|
||||
addMessageListener('trigger-control-channel-open', function(reason) {
|
||||
debug('Got message: trigger-control-channel-open');
|
||||
mockControlChannelOfSender.notifyOpened();
|
||||
mockControlChannelOfReceiver.notifyOpened();
|
||||
mockControlChannelOfSender.notifyConnected();
|
||||
mockControlChannelOfReceiver.notifyConnected();
|
||||
});
|
||||
|
||||
addMessageListener('trigger-on-offer', function() {
|
||||
|
|
|
@ -110,8 +110,8 @@ const clientListener = {
|
|||
setTimeout(()=>this._remoteBuilder.onIceCandidate(aCandidate), 0);
|
||||
},
|
||||
disconnect: function(aReason) {
|
||||
setTimeout(()=>this._localBuilder.notifyClosed(aReason), 0);
|
||||
setTimeout(()=>this._remoteBuilder.notifyClosed(aReason), 0);
|
||||
setTimeout(()=>this._localBuilder.notifyDisconnected(aReason), 0);
|
||||
setTimeout(()=>this._remoteBuilder.notifyDisconnected(aReason), 0);
|
||||
},
|
||||
set remoteBuilder(aRemoteBuilder) {
|
||||
this._remoteBuilder = aRemoteBuilder;
|
||||
|
@ -142,8 +142,8 @@ const serverListener = {
|
|||
setTimeout(()=>this._remoteBuilder.onIceCandidate(aCandidate), 0);
|
||||
},
|
||||
disconnect: function(aReason) {
|
||||
setTimeout(()=>this._localBuilder.notifyClosed(aReason), 0);
|
||||
setTimeout(()=>this._remoteBuilder.notifyClosed(aReason), 0);
|
||||
setTimeout(()=>this._localBuilder.notifyDisconnected(aReason), 0);
|
||||
setTimeout(()=>this._remoteBuilder.notifyDisconnected(aReason), 0);
|
||||
},
|
||||
set remoteBuilder(aRemoteBuilder) {
|
||||
this._remoteBuilder = aRemoteBuilder;
|
||||
|
|
|
@ -113,14 +113,14 @@ function disconnect() {
|
|||
controllerState.onChannelClosed(Cr.NS_OK, false);
|
||||
Assert.equal(controllerState.state, State.CLOSING, 'controller in closing state');
|
||||
|
||||
mockReceiverChannel.notifyClosed = function(reason) {
|
||||
mockReceiverChannel.notifyDisconnected = function(reason) {
|
||||
Assert.equal(reason, Cr.NS_OK, 'receive close reason');
|
||||
Assert.equal(receiverState.state, State.CLOSED, 'receiver in closed state');
|
||||
|
||||
receiverState.onChannelClosed(Cr.NS_OK, true);
|
||||
Assert.equal(receiverState.state, State.CLOSED, 'receiver in closed state');
|
||||
|
||||
mockControllerChannel.notifyClosed = function(reason) {
|
||||
mockControllerChannel.notifyDisconnected = function(reason) {
|
||||
Assert.equal(reason, Cr.NS_OK, 'receive close reason');
|
||||
Assert.equal(controllerState.state, State.CLOSED, 'controller in closed state');
|
||||
|
||||
|
@ -139,14 +139,14 @@ function receiverDisconnect() {
|
|||
receiverState.onChannelClosed(Cr.NS_OK, false);
|
||||
Assert.equal(receiverState.state, State.CLOSING, 'receiver in closing state');
|
||||
|
||||
mockControllerChannel.notifyClosed = function(reason) {
|
||||
mockControllerChannel.notifyDisconnected = function(reason) {
|
||||
Assert.equal(reason, Cr.NS_OK, 'receive close reason');
|
||||
Assert.equal(controllerState.state, State.CLOSED, 'controller in closed state');
|
||||
|
||||
controllerState.onChannelClosed(Cr.NS_OK, true);
|
||||
Assert.equal(controllerState.state, State.CLOSED, 'controller in closed state');
|
||||
|
||||
mockReceiverChannel.notifyClosed = function(reason) {
|
||||
mockReceiverChannel.notifyDisconnected = function(reason) {
|
||||
Assert.equal(reason, Cr.NS_OK, 'receive close reason');
|
||||
Assert.equal(receiverState.state, State.CLOSED, 'receiver in closed state');
|
||||
|
||||
|
@ -166,14 +166,14 @@ function abnormalDisconnect() {
|
|||
controllerState.onChannelClosed(testErrorReason, false);
|
||||
Assert.equal(controllerState.state, State.CLOSING, 'controller in closing state');
|
||||
|
||||
mockReceiverChannel.notifyClosed = function(reason) {
|
||||
mockReceiverChannel.notifyDisconnected = function(reason) {
|
||||
Assert.equal(reason, testErrorReason, 'receive abnormal close reason');
|
||||
Assert.equal(receiverState.state, State.CLOSED, 'receiver in closed state');
|
||||
|
||||
receiverState.onChannelClosed(Cr.NS_OK, true);
|
||||
Assert.equal(receiverState.state, State.CLOSED, 'receiver in closed state');
|
||||
|
||||
mockControllerChannel.notifyClosed = function(reason) {
|
||||
mockControllerChannel.notifyDisconnected = function(reason) {
|
||||
Assert.equal(reason, testErrorReason, 'receive abnormal close reason');
|
||||
Assert.equal(controllerState.state, State.CLOSED, 'controller in closed state');
|
||||
|
||||
|
|
|
@ -111,11 +111,11 @@ function testPresentationServer() {
|
|||
}
|
||||
controllerControlChannel.disconnect(CLOSE_CONTROL_CHANNEL_REASON);
|
||||
},
|
||||
notifyOpened: function() {
|
||||
notifyConnected: function() {
|
||||
Assert.equal(this.status, 'created', '0. controllerControlChannel: opened');
|
||||
this.status = 'opened';
|
||||
},
|
||||
notifyClosed: function(aReason) {
|
||||
notifyDisconnected: function(aReason) {
|
||||
Assert.equal(this.status, 'onOffer', '4. controllerControlChannel: closed');
|
||||
Assert.equal(aReason, CLOSE_CONTROL_CHANNEL_REASON, 'controllerControlChannel notify closed');
|
||||
this.status = 'closed';
|
||||
|
@ -160,7 +160,7 @@ function testPresentationServer() {
|
|||
onIceCandidate: function(aCandidate) {
|
||||
Assert.ok(false, 'get ICE candidate');
|
||||
},
|
||||
notifyOpened: function() {
|
||||
notifyConnected: function() {
|
||||
Assert.equal(this.status, 'created', '0. presenterControlChannel: opened, send offer');
|
||||
presenterControlChannel.launch('testPresentationId', 'http://example.com');
|
||||
this.status = 'opened';
|
||||
|
@ -172,7 +172,7 @@ function testPresentationServer() {
|
|||
Assert.ok(false, 'sending offer fails:' + e);
|
||||
}
|
||||
},
|
||||
notifyClosed: function(aReason) {
|
||||
notifyDisconnected: function(aReason) {
|
||||
this.status = 'closed';
|
||||
Assert.equal(aReason, CLOSE_CONTROL_CHANNEL_REASON, '4. presenterControlChannel notify closed');
|
||||
yayFuncs.presenterControlChannelClose();
|
||||
|
|
Загрузка…
Ссылка в новой задаче