Skip to content

Commit

Permalink
ProtoDatabaseTest Flush thread on lock release
Browse files Browse the repository at this point in the history
Lock releasing is done on a background thread.
It is necessary to wait until the lock is released.
The test is very flaky on iOS devices.

Change-Id: Ie8fe6106c21461bd8f78438650c53587099adfcd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1497053
Reviewed-by: ssid <ssid@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637388}
  • Loading branch information
Olivier Robin authored and Commit Bot committed Mar 4, 2019
1 parent 1454e52 commit 742f652
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/task/task_scheduler/task_scheduler.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/thread.h"
#include "components/leveldb_proto/internal/shared_proto_database_provider.h"
Expand Down Expand Up @@ -556,6 +557,7 @@ TEST_F(ProtoDatabaseImplTest, Migration_EmptyDBs_UniqueToShared) {
Enums::InitStatus::kOK);
// Kill the DB impl so it doesn't have a lock on the DB anymore.
unique_db_impl.reset();
base::TaskScheduler::GetInstance()->FlushForTesting();

auto db_provider_withshared = CreateProviderWithSharedDB();
auto shared_db_impl = CreateDBImpl(
Expand Down Expand Up @@ -832,4 +834,4 @@ TEST_F(ProtoDatabaseImplTest, DestroyShouldWorkWhenUniqueInitFailed) {
EXPECT_FALSE(base::PathExists(temp_dir.GetPath()));
}

} // namespace leveldb_proto
} // namespace leveldb_proto

0 comments on commit 742f652

Please sign in to comment.