You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Merge branch 'dbkr/stop_devicelist' into dbkr/e2e_backups
This commit is contained in:
@@ -59,16 +59,25 @@ describe('DeviceList', function() {
|
|||||||
let downloadSpy;
|
let downloadSpy;
|
||||||
let sessionStore;
|
let sessionStore;
|
||||||
let cryptoStore;
|
let cryptoStore;
|
||||||
|
let deviceLists = [];
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
testUtils.beforeEach(this); // eslint-disable-line no-invalid-this
|
testUtils.beforeEach(this); // eslint-disable-line no-invalid-this
|
||||||
|
|
||||||
|
deviceLists = [];
|
||||||
|
|
||||||
downloadSpy = expect.createSpy();
|
downloadSpy = expect.createSpy();
|
||||||
const mockStorage = new MockStorageApi();
|
const mockStorage = new MockStorageApi();
|
||||||
sessionStore = new WebStorageSessionStore(mockStorage);
|
sessionStore = new WebStorageSessionStore(mockStorage);
|
||||||
cryptoStore = new MemoryCryptoStore();
|
cryptoStore = new MemoryCryptoStore();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
|
for (const dl of deviceLists) {
|
||||||
|
dl.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function createTestDeviceList() {
|
function createTestDeviceList() {
|
||||||
const baseApis = {
|
const baseApis = {
|
||||||
downloadKeysForUsers: downloadSpy,
|
downloadKeysForUsers: downloadSpy,
|
||||||
@@ -76,7 +85,9 @@ describe('DeviceList', function() {
|
|||||||
const mockOlm = {
|
const mockOlm = {
|
||||||
verifySignature: function(key, message, signature) {},
|
verifySignature: function(key, message, signature) {},
|
||||||
};
|
};
|
||||||
return new DeviceList(baseApis, cryptoStore, sessionStore, mockOlm);
|
const dl = new DeviceList(baseApis, cryptoStore, sessionStore, mockOlm);
|
||||||
|
deviceLists.push(dl);
|
||||||
|
return dl;
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should successfully download and store device keys", function() {
|
it("should successfully download and store device keys", function() {
|
||||||
|
|||||||
@@ -162,6 +162,12 @@ export default class DeviceList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
if (this._saveTimer !== null) {
|
||||||
|
clearTimeout(this._saveTimer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the device tracking state to storage, if any changes are
|
* Save the device tracking state to storage, if any changes are
|
||||||
* pending other than updating the sync token
|
* pending other than updating the sync token
|
||||||
|
|||||||
@@ -338,6 +338,7 @@ Crypto.prototype.start = function() {
|
|||||||
/** Stop background processes related to crypto */
|
/** Stop background processes related to crypto */
|
||||||
Crypto.prototype.stop = function() {
|
Crypto.prototype.stop = function() {
|
||||||
this._outgoingRoomKeyRequestManager.stop();
|
this._outgoingRoomKeyRequestManager.stop();
|
||||||
|
this._deviceList.stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user