1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/prefs/persistent_pref_store.h"
7 #include "base/functional/bind.h"
8 #include "base/run_loop.h"
9 #include "base/sequence_checker_impl.h"
10 #include "base/test/task_environment.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 void TestCommitPendingWriteWithCallback(
14 PersistentPrefStore* store,
15 base::test::TaskEnvironment* task_environment) {
16 base::RunLoop run_loop;
17 base::SequenceCheckerImpl sequence_checker;
18 store->CommitPendingWrite(base::BindOnce(
19 [](base::SequenceCheckerImpl* sequence_checker, base::RunLoop* run_loop) {
20 EXPECT_TRUE(sequence_checker->CalledOnValidSequence());
23 base::Unretained(&sequence_checker), base::Unretained(&run_loop)));
24 task_environment->RunUntilIdle();