Skip to content

Commit

Permalink
Rework enableEncryption tet to be less timing dependent
Browse files Browse the repository at this point in the history
  • Loading branch information
nvrWhere committed Sep 15, 2024
1 parent b883c61 commit 004dcc9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions autotests/testolmaccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,20 +445,18 @@ void TestOlmAccount::claimMultipleKeys()
void TestOlmAccount::enableEncryption()
{
CREATE_CONNECTION(alice, "alice9"_L1, "secret"_L1, "AlicePhone"_L1)
alice->syncLoop();

QSignalSpy createRoomSpy(alice.get(), &Connection::loadedRoomState);
auto job = alice->createRoom(Connection::PublishRoom, {}, {}, {}, {});
QSignalSpy createRoomSpy(job, &BaseJob::success);
QVERIFY(createRoomSpy.wait(10000));
alice->sync();
connect(alice.get(), &Connection::syncDone, this, [alice](){
alice->sync();
});

while(alice->roomsCount(JoinState::Join) == 0) {
QThread::sleep(100);
}
auto room = alice->rooms(JoinState::Join)[0];
room->activateEncryption();
QSignalSpy encryptionSpy(room, &Room::encryption);
room->activateEncryption();
QVERIFY(encryptionSpy.wait(10000));
QVERIFY(room->usesEncryption());
}
Expand Down

0 comments on commit 004dcc9

Please sign in to comment.