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

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

Issue 10946042: Remove ScopedTempDir from sync test utility class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « sync/test/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) 2012 The Chromium Authors. All rights reserved. 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 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 "sync/test/engine/test_directory_setter_upper.h" 5 #include "sync/test/engine/test_directory_setter_upper.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 11 matching lines...) Expand all
22 22
23 TestDirectorySetterUpper::~TestDirectorySetterUpper() {} 23 TestDirectorySetterUpper::~TestDirectorySetterUpper() {}
24 24
25 void TestDirectorySetterUpper::SetUp() { 25 void TestDirectorySetterUpper::SetUp() {
26 directory_.reset(new syncable::Directory( 26 directory_.reset(new syncable::Directory(
27 new syncable::InMemoryDirectoryBackingStore(name_), 27 new syncable::InMemoryDirectoryBackingStore(name_),
28 &handler_, 28 &handler_,
29 NULL, 29 NULL,
30 &encryption_handler_, 30 &encryption_handler_,
31 encryption_handler_.cryptographer())); 31 encryption_handler_.cryptographer()));
32 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
33 ASSERT_EQ(syncable::OPENED, directory_->Open( 32 ASSERT_EQ(syncable::OPENED, directory_->Open(
34 name_, &delegate_, NullTransactionObserver())); 33 name_, &delegate_, NullTransactionObserver()));
35 } 34 }
36 35
37 void TestDirectorySetterUpper::TearDown() { 36 void TestDirectorySetterUpper::TearDown() {
38 if (!directory()->good()) 37 if (!directory()->good())
39 return; 38 return;
40 39
41 RunInvariantCheck(); 40 RunInvariantCheck();
42 directory()->SaveChanges(); 41 directory()->SaveChanges();
43 RunInvariantCheck(); 42 RunInvariantCheck();
44 directory()->SaveChanges(); 43 directory()->SaveChanges();
45 44
46 directory_.reset(); 45 directory_.reset();
47
48 ASSERT_TRUE(temp_dir_.Delete());
49 } 46 }
50 47
51 void TestDirectorySetterUpper::RunInvariantCheck() { 48 void TestDirectorySetterUpper::RunInvariantCheck() {
52 // Check invariants for all items. 49 // Check invariants for all items.
53 syncable::ReadTransaction trans(FROM_HERE, directory()); 50 syncable::ReadTransaction trans(FROM_HERE, directory());
54 51
55 // The TestUnrecoverableErrorHandler that this directory was constructed with 52 // The TestUnrecoverableErrorHandler that this directory was constructed with
56 // will handle error reporting, so we can safely ignore the return value. 53 // will handle error reporting, so we can safely ignore the return value.
57 directory()->FullyCheckTreeInvariants(&trans); 54 directory()->FullyCheckTreeInvariants(&trans);
58 } 55 }
59 56
60 } // namespace syncer 57 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/test/engine/test_directory_setter_upper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698