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

Side by Side Diff: chrome/test/sync/engine/test_directory_setter_upper.cc

Issue 235010: Reverting 27117. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/sync/engine/test_directory_setter_upper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/sync/engine/test_directory_setter_upper.h" 5 #include "chrome/test/sync/engine/test_directory_setter_upper.h"
6 6
7 #include "chrome/browser/sync/syncable/directory_manager.h" 7 #include "chrome/browser/sync/syncable/directory_manager.h"
8 #include "chrome/browser/sync/syncable/syncable.h" 8 #include "chrome/browser/sync/syncable/syncable.h"
9 #include "chrome/browser/sync/util/compat_file.h" 9 #include "chrome/browser/sync/util/compat_file.h"
10 #include "chrome/browser/sync/util/event_sys-inl.h" 10 #include "chrome/browser/sync/util/event_sys-inl.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 using syncable::DirectoryManager; 13 using syncable::DirectoryManager;
14 using syncable::ReadTransaction; 14 using syncable::ReadTransaction;
15 using syncable::ScopedDirLookup; 15 using syncable::ScopedDirLookup;
16 16
17 namespace browser_sync { 17 namespace browser_sync {
18 18
19 TestDirectorySetterUpper::TestDirectorySetterUpper() : name_(PSTR("Test")) {} 19 TestDirectorySetterUpper::TestDirectorySetterUpper() : name_(PSTR("Test")) {}
20 20
21 TestDirectorySetterUpper::~TestDirectorySetterUpper() {} 21 TestDirectorySetterUpper::~TestDirectorySetterUpper() {}
22 22
23 void TestDirectorySetterUpper::Init() { 23 void TestDirectorySetterUpper::SetUp() {
24 PathString test_data_dir_ = PSTR("."); 24 PathString test_data_dir_ = PSTR(".");
25 manager_.reset(new DirectoryManager(test_data_dir_)); 25 manager_.reset(new DirectoryManager(test_data_dir_));
26 file_path_ = manager_->GetSyncDataDatabasePath(); 26 file_path_ = manager_->GetSyncDataDatabasePath();
27 PathRemove(file_path_.c_str()); 27 PathRemove(file_path_.c_str());
28 }
29 28
30 void TestDirectorySetterUpper::SetUp() {
31 Init();
32 ASSERT_TRUE(manager()->Open(name())); 29 ASSERT_TRUE(manager()->Open(name()));
33 } 30 }
34 31
35 void TestDirectorySetterUpper::TearDown() { 32 void TestDirectorySetterUpper::TearDown() {
36 if (!manager()) 33 if (!manager())
37 return; 34 return;
38 35
39 { 36 {
40 // A small scope so we don't have the dir open when we close it and reset 37 // A small scope so we don't have the dir open when we close it and reset
41 // the DirectoryManager below. 38 // the DirectoryManager below.
(...skipping 18 matching lines...) Expand all
60 ReadTransaction trans(dir, __FILE__, __LINE__); 57 ReadTransaction trans(dir, __FILE__, __LINE__);
61 dir->CheckTreeInvariants(&trans, false); 58 dir->CheckTreeInvariants(&trans, false);
62 } 59 }
63 { 60 {
64 // Check invariants for all items. 61 // Check invariants for all items.
65 ReadTransaction trans(dir, __FILE__, __LINE__); 62 ReadTransaction trans(dir, __FILE__, __LINE__);
66 dir->CheckTreeInvariants(&trans, true); 63 dir->CheckTreeInvariants(&trans, true);
67 } 64 }
68 } 65 }
69 66
70 void ManuallyOpenedTestDirectorySetterUpper::SetUp() {
71 Init();
72 }
73
74 void ManuallyOpenedTestDirectorySetterUpper::Open() {
75 ASSERT_TRUE(manager()->Open(name()));
76 was_opened_ = true;
77 }
78
79 void ManuallyOpenedTestDirectorySetterUpper::TearDown() {
80 if (was_opened_) {
81 TestDirectorySetterUpper::TearDown();
82 }
83 }
84
85 } // namespace browser_sync 67 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/test/sync/engine/test_directory_setter_upper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698