Remove custom RSA-AES event

We shouldn't add extra, undocumented, API just for the tests. They need
to figure out less invasive way to probe things.
This commit is contained in:
Pierre Ossman 2023-05-16 19:38:33 +02:00
parent 458405e05d
commit afbb1da4d5
2 changed files with 14 additions and 5 deletions

View File

@ -1864,7 +1864,6 @@ export default class RFB extends EventTargetMixin {
} }
}) })
.then(() => { .then(() => {
this.dispatchEvent(new CustomEvent('securityresult'));
this._rfbInitState = "SecurityResult"; this._rfbInitState = "SecurityResult";
return true; return true;
}).finally(() => { }).finally(() => {

View File

@ -1631,10 +1631,20 @@ describe('Remote Frame Buffer Protocol Client', function () {
client.addEventListener("credentialsrequired", (e) => { client.addEventListener("credentialsrequired", (e) => {
client.sendCredentials({ "password": "123456" }); client.sendCredentials({ "password": "123456" });
clock.tick(); clock.tick();
}); // FIXME: We don't have a good way to know when
client.addEventListener("securityresult", (event) => { // the async stuff is done, so we hook in
expect(client._sock).to.have.sent(sendData); // to this internal function that is
done(); // called at the end
new Promise((resolve, reject) => {
sinon.stub(client._sock._websocket, "send")
.callsFake((data) => {
FakeWebSocket.prototype.send.call(client._sock._websocket, data);
resolve();
});
}).then(() => {
expect(client._sock).to.have.sent(sendData);
done();
});
}); });
client._sock._websocket._receiveData(receiveData); client._sock._websocket._receiveData(receiveData);
}); });