mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-16 00:03:45 +00:00
Added WebRTC test case
This commit is contained in:
@@ -301,6 +301,7 @@ function start()
|
|||||||
.then(function () { return (testLMS()); })
|
.then(function () { return (testLMS()); })
|
||||||
.then(function () { return (testConsoleHelp()); })
|
.then(function () { return (testConsoleHelp()); })
|
||||||
.then(function () { return (testCPUInfo()); })
|
.then(function () { return (testCPUInfo()); })
|
||||||
|
.then(function () { return (WebRTC_Test()); })
|
||||||
.then(function () { return (testTunnel()); })
|
.then(function () { return (testTunnel()); })
|
||||||
.then(function () { return (testTerminal()); })
|
.then(function () { return (testTerminal()); })
|
||||||
.then(function () { return (testKVM()); })
|
.then(function () { return (testKVM()); })
|
||||||
@@ -321,6 +322,36 @@ function start()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function WebRTC_Test()
|
||||||
|
{
|
||||||
|
console.log(' => Testing WebRTC');
|
||||||
|
|
||||||
|
var ret = new promise(function (r, j) { this._res = r; this._rej = j; });
|
||||||
|
ret.factory = require('ILibWebRTC').createNewFactory();
|
||||||
|
ret.serverConnection = ret.factory.createConnection();
|
||||||
|
ret.clientConnection = require('ILibWebRTC').createConnection();
|
||||||
|
ret.clientConnection.on('dataChannel', function (rtcchannel) { rtcchannel.write(Buffer.alloc(6665535)); });
|
||||||
|
|
||||||
|
var offer = ret.clientConnection.generateOffer()
|
||||||
|
var counter = ret.serverConnection.setOffer(offer);
|
||||||
|
ret.clientConnection.setOffer(counter);
|
||||||
|
|
||||||
|
ret.serverConnection.on('connected', function ()
|
||||||
|
{
|
||||||
|
this.dc = this.createDataChannel('Test Data Channel');
|
||||||
|
this.dc.on('data', function (b)
|
||||||
|
{
|
||||||
|
if (b.length == 6665535)
|
||||||
|
{
|
||||||
|
console.log(' => WebRTC Data Channel Test........[OK]');
|
||||||
|
ret._res();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
function DumpOnlyTest_cycle(pid, cyclecount, p, self)
|
function DumpOnlyTest_cycle(pid, cyclecount, p, self)
|
||||||
{
|
{
|
||||||
if(cyclecount==0) { p._res(); return; }
|
if(cyclecount==0) { p._res(); return; }
|
||||||
|
|||||||
Reference in New Issue
Block a user