Remove unused parameter.
[chromium-blink-merge.git] / sync / internal_api / public / test / test_user_share.h
blob2823fed780a192cd420ff24a494f9f9f13be8a42
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 // 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 // };
22 // Then, in your tests:
24 // TEST_F(AwesomenessTest, IsMaximal) {
25 // ReadTransaction trans(test_user_share_.user_share());
26 // ...
27 // }
30 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_
31 #define SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_
33 #include "base/basictypes.h"
34 #include "sync/internal_api/public/base/model_type.h"
35 #include "sync/internal_api/public/user_share.h"
37 namespace syncer {
39 class SyncEncryptionHandler;
40 class TestDirectorySetterUpper;
42 namespace syncable {
43 class TestTransactionObserver;
46 class TestUserShare {
47 public:
48 TestUserShare();
49 ~TestUserShare();
51 // Sets up the UserShare instance. Clears any existing database
52 // backing files that might exist on disk.
53 void SetUp();
55 // Undo everything done by SetUp(): closes the UserShare and deletes
56 // the backing files. Before closing the directory, this will run
57 // the directory invariant checks and perform the SaveChanges action
58 // on the user share's directory.
59 void TearDown();
61 // Save and reload Directory to clear out temporary data in memory.
62 bool Reload();
64 // Non-NULL iff called between a call to SetUp() and TearDown().
65 UserShare* user_share();
67 // Sync's encryption handler. Used by tests to invoke the sync encryption
68 // methods normally handled via the SyncBackendHost
69 SyncEncryptionHandler* encryption_handler();
71 // Returns the directory's transaction observer. This transaction observer
72 // has methods which can be helpful when writing test assertions.
73 syncable::TestTransactionObserver* transaction_observer();
75 // A helper function to pretend to download this type's root node.
76 static bool CreateRoot(syncer::ModelType model_type,
77 syncer::UserShare* service);
79 size_t GetDeleteJournalSize() const;
81 private:
82 scoped_ptr<TestDirectorySetterUpper> dir_maker_;
83 scoped_ptr<UserShare> user_share_;
85 DISALLOW_COPY_AND_ASSIGN(TestUserShare);
88 } // namespace syncer
90 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_