Enforce indentation
This commit is contained in:
+15
-15
@@ -20,17 +20,17 @@ chai.use(function (_chai, utils) {
|
||||
console.log("expected data: %o, actual data: %o", target_data, data);
|
||||
}
|
||||
this.assert(same,
|
||||
"expected #{this} to have displayed the image #{exp}, but instead it displayed #{act}",
|
||||
"expected #{this} not to have displayed the image #{act}",
|
||||
target_data,
|
||||
data);
|
||||
"expected #{this} to have displayed the image #{exp}, but instead it displayed #{act}",
|
||||
"expected #{this} not to have displayed the image #{act}",
|
||||
target_data,
|
||||
data);
|
||||
});
|
||||
|
||||
_chai.Assertion.addMethod('sent', function (target_data) {
|
||||
const obj = this._obj;
|
||||
obj.inspect = () => {
|
||||
const res = { _websocket: obj._websocket, rQi: obj._rQi, _rQ: new Uint8Array(obj._rQ.buffer, 0, obj._rQlen),
|
||||
_sQ: new Uint8Array(obj._sQ.buffer, 0, obj._sQlen) };
|
||||
_sQ: new Uint8Array(obj._sQ.buffer, 0, obj._sQlen) };
|
||||
res.prototype = obj;
|
||||
return res;
|
||||
};
|
||||
@@ -51,10 +51,10 @@ chai.use(function (_chai, utils) {
|
||||
console.log("expected data: %o, actual data: %o", target_data, data);
|
||||
}
|
||||
this.assert(same,
|
||||
"expected #{this} to have sent the data #{exp}, but it actually sent #{act}",
|
||||
"expected #{this} not to have sent the data #{act}",
|
||||
Array.prototype.slice.call(target_data),
|
||||
Array.prototype.slice.call(data));
|
||||
"expected #{this} to have sent the data #{exp}, but it actually sent #{act}",
|
||||
"expected #{this} not to have sent the data #{act}",
|
||||
Array.prototype.slice.call(target_data),
|
||||
Array.prototype.slice.call(data));
|
||||
});
|
||||
|
||||
_chai.Assertion.addProperty('array', function () {
|
||||
@@ -77,9 +77,9 @@ chai.use(function (_chai, utils) {
|
||||
}
|
||||
|
||||
this.assert(same,
|
||||
"expected #{this} to have elements deeply equal to #{exp}",
|
||||
"expected #{this} not to have elements deeply equal to #{exp}",
|
||||
Array.prototype.slice.call(target));
|
||||
"expected #{this} to have elements deeply equal to #{exp}",
|
||||
"expected #{this} not to have elements deeply equal to #{exp}",
|
||||
Array.prototype.slice.call(target));
|
||||
} else {
|
||||
for (let i = 0; i < obj.length; i++) {
|
||||
if (obj[i] != target[i]) {
|
||||
@@ -89,9 +89,9 @@ chai.use(function (_chai, utils) {
|
||||
}
|
||||
|
||||
this.assert(same,
|
||||
"expected #{this} to have elements equal to #{exp}",
|
||||
"expected #{this} not to have elements equal to #{exp}",
|
||||
Array.prototype.slice.call(target));
|
||||
"expected #{this} to have elements equal to #{exp}",
|
||||
"expected #{this} not to have elements equal to #{exp}",
|
||||
Array.prototype.slice.call(target));
|
||||
}
|
||||
} else {
|
||||
_super.apply(this, arguments);
|
||||
|
||||
+2
-2
@@ -51,8 +51,8 @@ export default class RecordingPlayer {
|
||||
this._disconnected = disconnected;
|
||||
|
||||
if (this._encoding === undefined) {
|
||||
const frame = this._frames[0];
|
||||
const start = frame.indexOf('{', 1) + 1;
|
||||
const frame = this._frames[0];
|
||||
const start = frame.indexOf('{', 1) + 1;
|
||||
if (frame.slice(start).startsWith('UkZC')) {
|
||||
this._encoding = 'base64';
|
||||
} else {
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('Helpers', function() {
|
||||
it('should map ASCII characters to keysyms', function() {
|
||||
expect(keysyms.lookup('a'.charCodeAt())).to.be.equal(0x61);
|
||||
expect(keysyms.lookup('A'.charCodeAt())).to.be.equal(0x41);
|
||||
});
|
||||
});
|
||||
it('should map Latin-1 characters to keysyms', function() {
|
||||
expect(keysyms.lookup('ø'.charCodeAt())).to.be.equal(0xf8);
|
||||
|
||||
|
||||
+33
-33
@@ -30,15 +30,15 @@ function push8(arr, num) {
|
||||
function push16(arr, num) {
|
||||
"use strict";
|
||||
arr.push((num >> 8) & 0xFF,
|
||||
num & 0xFF);
|
||||
num & 0xFF);
|
||||
}
|
||||
|
||||
function push32(arr, num) {
|
||||
"use strict";
|
||||
arr.push((num >> 24) & 0xFF,
|
||||
(num >> 16) & 0xFF,
|
||||
(num >> 8) & 0xFF,
|
||||
num & 0xFF);
|
||||
(num >> 16) & 0xFF,
|
||||
(num >> 8) & 0xFF,
|
||||
num & 0xFF);
|
||||
}
|
||||
|
||||
describe('Remote Frame Buffer Protocol Client', function() {
|
||||
@@ -286,7 +286,7 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
describe('#clipboardPasteFrom', function () {
|
||||
it('should send the given text in a paste event', function () {
|
||||
const expected = {_sQ: new Uint8Array(11), _sQlen: 0,
|
||||
_sQbufferSize: 11, flush: () => {}};
|
||||
_sQbufferSize: 11, flush: () => {}};
|
||||
RFB.messages.clientCutText(expected, 'abc');
|
||||
client.clipboardPasteFrom('abc');
|
||||
expect(client._sock).to.have.sent(expected._sQ);
|
||||
@@ -376,10 +376,10 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
it('should update the viewport when the remote session resizes', function () {
|
||||
// Simple ExtendedDesktopSize FBU message
|
||||
const incoming = [ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xfe, 0xcc,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00 ];
|
||||
0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xfe, 0xcc,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00 ];
|
||||
|
||||
sinon.spy(client._display, "viewportChangeSize");
|
||||
|
||||
@@ -566,10 +566,10 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
it('should update the scaling when the remote session resizes', function () {
|
||||
// Simple ExtendedDesktopSize FBU message
|
||||
const incoming = [ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xfe, 0xcc,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00 ];
|
||||
0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xfe, 0xcc,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00 ];
|
||||
|
||||
sinon.spy(client._display, "autoscale");
|
||||
|
||||
@@ -619,10 +619,10 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
it('should request a resize when initially connecting', function () {
|
||||
// Simple ExtendedDesktopSize FBU message
|
||||
const incoming = [ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x04, 0x00, 0x04, 0xff, 0xff, 0xfe, 0xcc,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x00 ];
|
||||
0x00, 0x04, 0x00, 0x04, 0xff, 0xff, 0xfe, 0xcc,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x00 ];
|
||||
|
||||
// First message should trigger a resize
|
||||
|
||||
@@ -715,10 +715,10 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
it('should not try to override a server resize', function () {
|
||||
// Simple ExtendedDesktopSize FBU message
|
||||
const incoming = [ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x04, 0x00, 0x04, 0xff, 0xff, 0xfe, 0xcc,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x00 ];
|
||||
0x00, 0x04, 0x00, 0x04, 0xff, 0xff, 0xfe, 0xcc,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x00 ];
|
||||
|
||||
client._sock._websocket._receive_data(new Uint8Array(incoming));
|
||||
|
||||
@@ -827,7 +827,7 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
describe('connecting', function () {
|
||||
it('should open the websocket connection', function () {
|
||||
const client = new RFB(document.createElement('div'),
|
||||
'ws://HOST:8675/PATH');
|
||||
'ws://HOST:8675/PATH');
|
||||
sinon.spy(client._sock, 'open');
|
||||
this.clock.tick();
|
||||
expect(client._sock.open).to.have.been.calledOnce;
|
||||
@@ -1357,7 +1357,7 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
const spy = sinon.spy();
|
||||
client.addEventListener("securityfailure", spy);
|
||||
const failure_data = [0, 0, 0, 1, 0, 0, 0, 12, 115, 117, 99, 104,
|
||||
32, 102, 97, 105, 108, 117, 114, 101];
|
||||
32, 102, 97, 105, 108, 117, 114, 101];
|
||||
client._sock._websocket._receive_data(new Uint8Array(failure_data));
|
||||
expect(spy.args[0][0].detail.status).to.equal(1);
|
||||
expect(spy.args[0][0].detail.reason).to.equal('such failure');
|
||||
@@ -1416,8 +1416,8 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
|
||||
function send_server_init(opts, client) {
|
||||
const full_opts = { width: 10, height: 12, bpp: 24, depth: 24, big_endian: 0,
|
||||
true_color: 1, red_max: 255, green_max: 255, blue_max: 255,
|
||||
red_shift: 16, green_shift: 8, blue_shift: 0, name: 'a name' };
|
||||
true_color: 1, red_max: 255, green_max: 255, blue_max: 255,
|
||||
red_shift: 16, green_shift: 8, blue_shift: 0, name: 'a name' };
|
||||
for (let opt in opts) {
|
||||
full_opts[opt] = opts[opt];
|
||||
}
|
||||
@@ -1664,7 +1664,7 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
client._display.blitRgbxImage(0, 0, 4, 2, new Uint8Array(target_data_check_arr.slice(0, 32)), 0);
|
||||
|
||||
const info = [{ x: 0, y: 2, width: 2, height: 2, encoding: 0x01},
|
||||
{ x: 2, y: 2, width: 2, height: 2, encoding: 0x01}];
|
||||
{ x: 2, y: 2, width: 2, height: 2, encoding: 0x01}];
|
||||
// data says [{ old_x: 2, old_y: 0 }, { old_x: 0, old_y: 0 }]
|
||||
const rects = [[0, 2, 0, 0], [0, 0, 0, 0]];
|
||||
send_fbu_msg([info[0]], [rects[0]], client, 2);
|
||||
@@ -1683,9 +1683,9 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
|
||||
it('should handle the RAW encoding', function () {
|
||||
const info = [{ x: 0, y: 0, width: 2, height: 2, encoding: 0x00 },
|
||||
{ x: 2, y: 0, width: 2, height: 2, encoding: 0x00 },
|
||||
{ x: 0, y: 2, width: 4, height: 1, encoding: 0x00 },
|
||||
{ x: 0, y: 3, width: 4, height: 1, encoding: 0x00 }];
|
||||
{ x: 2, y: 0, width: 2, height: 2, encoding: 0x00 },
|
||||
{ x: 0, y: 2, width: 4, height: 1, encoding: 0x00 },
|
||||
{ x: 0, y: 3, width: 4, height: 1, encoding: 0x00 }];
|
||||
// data is in bgrx
|
||||
const rects = [
|
||||
[0x00, 0x00, 0xff, 0, 0x00, 0xff, 0x00, 0, 0x00, 0xff, 0x00, 0, 0x00, 0x00, 0xff, 0],
|
||||
@@ -1698,9 +1698,9 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
|
||||
it('should handle the RAW encoding in low colour mode', function () {
|
||||
const info = [{ x: 0, y: 0, width: 2, height: 2, encoding: 0x00 },
|
||||
{ x: 2, y: 0, width: 2, height: 2, encoding: 0x00 },
|
||||
{ x: 0, y: 2, width: 4, height: 1, encoding: 0x00 },
|
||||
{ x: 0, y: 3, width: 4, height: 1, encoding: 0x00 }];
|
||||
{ x: 2, y: 0, width: 2, height: 2, encoding: 0x00 },
|
||||
{ x: 0, y: 2, width: 4, height: 1, encoding: 0x00 },
|
||||
{ x: 0, y: 3, width: 4, height: 1, encoding: 0x00 }];
|
||||
const rects = [
|
||||
[0x03, 0x03, 0x03, 0x03],
|
||||
[0x0c, 0x0c, 0x0c, 0x0c],
|
||||
@@ -1716,7 +1716,7 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||
client._display.blitRgbxImage(0, 0, 4, 2, new Uint8Array(target_data_check_arr.slice(0, 32)), 0);
|
||||
|
||||
const info = [{ x: 0, y: 2, width: 2, height: 2, encoding: 0x01},
|
||||
{ x: 2, y: 2, width: 2, height: 2, encoding: 0x01}];
|
||||
{ x: 2, y: 2, width: 2, height: 2, encoding: 0x01}];
|
||||
// data says [{ old_x: 0, old_y: 0 }, { old_x: 0, old_y: 0 }]
|
||||
const rects = [[0, 2, 0, 0], [0, 0, 0, 0]];
|
||||
send_fbu_msg(info, rects, client);
|
||||
|
||||
@@ -19,9 +19,9 @@ describe('Websock', function() {
|
||||
});
|
||||
describe('rQlen', function () {
|
||||
it('should return the length of the receive queue', function () {
|
||||
sock.set_rQi(0);
|
||||
sock.set_rQi(0);
|
||||
|
||||
expect(sock.rQlen()).to.equal(RQ_TEMPLATE.length);
|
||||
expect(sock.rQlen()).to.equal(RQ_TEMPLATE.length);
|
||||
});
|
||||
|
||||
it("should return the proper length if we read some from the receive queue", function () {
|
||||
@@ -247,7 +247,7 @@ describe('Websock', function() {
|
||||
describe('lifecycle methods', function () {
|
||||
let old_WS;
|
||||
before(function () {
|
||||
old_WS = WebSocket;
|
||||
old_WS = WebSocket;
|
||||
});
|
||||
|
||||
let sock;
|
||||
@@ -357,8 +357,8 @@ describe('Websock', function() {
|
||||
describe('WebSocket Receiving', function () {
|
||||
let sock;
|
||||
beforeEach(function () {
|
||||
sock = new Websock();
|
||||
sock._allocate_buffers();
|
||||
sock = new Websock();
|
||||
sock._allocate_buffers();
|
||||
});
|
||||
|
||||
it('should support adding binary Uint8Array data to the receive queue', function () {
|
||||
|
||||
Reference in New Issue
Block a user