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

Unified Diff: chrome/test/sync/engine/test_directory_setter_upper.h

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/sync/engine/test_directory_setter_upper.h
===================================================================
--- chrome/test/sync/engine/test_directory_setter_upper.h (revision 0)
+++ chrome/test/sync/engine/test_directory_setter_upper.h (revision 0)
@@ -0,0 +1,72 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// A handy class that takes care of setting up and destroying a
+// syncable::Directory instance for unit tests that require one.
+//
+// The expected usage is to make this a component of your test fixture:
+//
+// class AwesomenessTest : public testing::Test {
+// public:
+// virtual void SetUp() {
+// metadb_.SetUp();
+// }
+// virtual void TearDown() {
+// metadb_.TearDown();
+// }
+// protected:
+// TestDirectorySetterUpper metadb_;
+// };
+//
+// Then, in your tests, get at the directory like so:
+//
+// TEST_F(AwesomenessTest, IsMaximal) {
+// ScopedDirLookup dir(metadb_.manager(), metadb_.name());
+// ... now use |dir| to get at syncable::Entry objects ...
+// }
+//
+
+#ifndef CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_
+#define CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/sync/syncable/syncable.h"
+#include "chrome/browser/sync/util/sync_types.h"
+
+namespace syncable {
+class DirectoryManager;
+class ScopedDirLookup;
+} // namespace syncable
+
+namespace browser_sync {
+
+class TestDirectorySetterUpper {
+ public:
+ TestDirectorySetterUpper();
+ ~TestDirectorySetterUpper();
+
+ // Create a DirectoryManager instance and use it to open the directory.
+ // Clears any existing database backing files that might exist on disk.
+ void SetUp();
+
+ // Undo everything done by SetUp(): close the directory and delete
+ // the backing files. Before closing the directory, this will run the
+ // directory invariant checks and perform the SaveChanges action on
+ // the directory.
+ void TearDown();
+
+ syncable::DirectoryManager* manager() const { return manager_.get(); }
+ const PathString& name() const { return name_; }
+
+ private:
+ void RunInvariantCheck(const syncable::ScopedDirLookup& dir);
+
+ scoped_ptr<syncable::DirectoryManager> manager_;
+ const PathString name_;
+ PathString file_path_;
+};
+
+} // namespace browser_sync
+
+#endif // CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_
Property changes on: chrome\test\sync\engine\test_directory_setter_upper.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698