Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: sync/internal_api/test/model_type_store_test_util.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "sync/internal_api/public/test/model_type_store_test_util.h"
6
7 #include <utility>
8
9 #include "base/bind.h"
10 #include "base/run_loop.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace syncer_v2 {
14
15 using Result = ModelTypeStore::Result;
16
17 namespace {
18
19 void MoveStoreToScopedPtr(std::unique_ptr<ModelTypeStore>* out_store,
20 Result result,
21 std::unique_ptr<ModelTypeStore> in_store) {
22 ASSERT_EQ(Result::SUCCESS, result);
23 std::swap(*out_store, in_store);
24 }
25
26 } // namespace
27
28 // static
29 std::unique_ptr<ModelTypeStore>
30 ModelTypeStoreTestUtil::CreateInMemoryStoreForTest() {
31 std::unique_ptr<ModelTypeStore> store;
32 ModelTypeStore::CreateInMemoryStoreForTest(
33 base::Bind(&MoveStoreToScopedPtr, &store));
34
35 // Force the initialization to run now, synchronously.
36 base::RunLoop().RunUntilIdle();
37
38 EXPECT_TRUE(store);
39 return store;
40 }
41
42 // static
43 void ModelTypeStoreTestUtil::MoveStoreToCallback(
44 std::unique_ptr<ModelTypeStore> store,
45 const ModelTypeStore::InitCallback& callback) {
46 ASSERT_TRUE(store);
47 callback.Run(Result::SUCCESS, std::move(store));
48 }
49
50 } // namespace syncer_v2
OLDNEW
« no previous file with comments | « sync/internal_api/test/fake_sync_manager.cc ('k') | sync/internal_api/test/sync_manager_factory_for_profile_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698