mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-10 07:44:25 +00:00
c66ae7b2e4
Launch an Xspice and run: echo -ne "\033]844;127.0.0.1;9876\007" This will launch a SPiCE client connecting to 127.0.0.1:9876. Still need to add all the security stuff and generally be more defensive in the implementation.
100 lines
2.1 KiB
JavaScript
100 lines
2.1 KiB
JavaScript
suite('DisplayProcess', function() {
|
|
var sut;
|
|
var runQ;
|
|
var fakePacketFilter;
|
|
var fakeClientGui;
|
|
var displayRouter;
|
|
var packetWorkerIdentifier;
|
|
|
|
setup(function(){
|
|
wdi.Debug.debug = false; //disable debugging, it slows tests
|
|
});
|
|
|
|
suite('#process()', function() {
|
|
setup(function() {
|
|
runQ = new wdi.RunQueue();
|
|
|
|
fakePacketFilter = {
|
|
notifyEnd: function() {
|
|
|
|
},
|
|
|
|
filter: function(o, fn, scope) {
|
|
fn.call(scope, o);
|
|
}
|
|
};
|
|
|
|
fakeClientGui = {};
|
|
|
|
displayRouter = new wdi.DisplayRouter();
|
|
|
|
packetWorkerIdentifier = {
|
|
getImageProperties: function() {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
displayRouter.packetProcess = function(spiceMessage) {}; //replace packetProcess, because of partial mocking
|
|
sut = new wdi.DisplayProcess({
|
|
runQ: runQ,
|
|
packetFilter: fakePacketFilter,
|
|
clientGui: fakeClientGui,
|
|
displayRouter: displayRouter,
|
|
packetWorkerIdentifier: packetWorkerIdentifier
|
|
});
|
|
|
|
|
|
wdi.ExecutionControl.sync = true;
|
|
});
|
|
|
|
test('displayProcess process should call packetFilfer process', sinon.test(function() {
|
|
var fakeProxy = {
|
|
end:function() {
|
|
|
|
}
|
|
};
|
|
runQ.add = function(fnStart, scope, fnEnd) {
|
|
fnStart.call(scope, fakeProxy);
|
|
}
|
|
this.mock(fakePacketFilter)
|
|
.expects('filter')
|
|
.once();
|
|
sut._process(false);
|
|
}));
|
|
|
|
test('displayProcess process should call packetFilfer notifyEnd', sinon.test(function() {
|
|
runQ.add = function(fn, scope, endFn) {
|
|
fn.call(scope,{end:function(){}});
|
|
endFn.call(scope);
|
|
};
|
|
|
|
this.mock(fakePacketFilter)
|
|
.expects('notifyEnd')
|
|
.once();
|
|
sut._process(false);
|
|
}));
|
|
|
|
test('displayProcess process should call runq add', sinon.test(function() {
|
|
this.mock(runQ)
|
|
.expects('add')
|
|
.once();
|
|
sut._process(false);
|
|
}));
|
|
|
|
|
|
test('displayProcess process should call runq process', sinon.test(function() {
|
|
this.mock(runQ)
|
|
.expects('process')
|
|
.once();
|
|
sut._process(false);
|
|
}));
|
|
|
|
test('displayProcess process should call runq process', sinon.test(function() {
|
|
this.mock(runQ)
|
|
.expects('process')
|
|
.once();
|
|
sut._process(false);
|
|
}));
|
|
});
|
|
});
|