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

Side by Side Diff: chrome/browser/sync/test/engine/test_user_share.h

Issue 10147003: [Sync] Move 'syncapi_core' and 'sync_unit_tests' targets to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win update errors Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 // A handy class that takes care of setting up and destroying a
6 // sync_api::UserShare instance for unit tests that require one.
7 //
8 // The expected usage is to make this a component of your test fixture:
9 //
10 // class AwesomenessTest : public testing::Test {
11 // public:
12 // virtual void SetUp() {
13 // test_user_share_.SetUp();
14 // }
15 // virtual void TearDown() {
16 // test_user_share_.TearDown();
17 // }
18 // protected:
19 // TestUserShare test_user_share_;
20 // };
21 //
22 // Then, in your tests:
23 //
24 // TEST_F(AwesomenessTest, IsMaximal) {
25 // sync_api::ReadTransaction trans(test_user_share_.user_share());
26 // ...
27 // }
28 //
29
30 #ifndef CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_USER_SHARE_H_
31 #define CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_USER_SHARE_H_
32 #pragma once
33
34 #include "base/basictypes.h"
35 #include "chrome/browser/sync/internal_api/user_share.h"
36 #include "sync/test/engine/test_directory_setter_upper.h"
37
38 namespace browser_sync {
39
40 class TestUserShare {
41 public:
42 TestUserShare();
43 ~TestUserShare();
44
45 // Sets up the UserShare instance. Clears any existing database
46 // backing files that might exist on disk.
47 void SetUp();
48
49 // Undo everything done by SetUp(): closes the UserShare and deletes
50 // the backing files. Before closing the directory, this will run
51 // the directory invariant checks and perform the SaveChanges action
52 // on the user share's directory.
53 void TearDown();
54
55 // Non-NULL iff called between a call to SetUp() and TearDown().
56 sync_api::UserShare* user_share();
57
58 private:
59 TestDirectorySetterUpper dir_maker_;
60 scoped_ptr<sync_api::UserShare> user_share_;
61
62 DISALLOW_COPY_AND_ASSIGN(TestUserShare);
63 };
64
65 } // namespace browser_sync
66
67 #endif // CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_USER_SHARE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_typed_url_unittest.cc ('k') | chrome/browser/sync/test/engine/test_user_share.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698