OLD | NEW |
| (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 #include "sync/internal_api/test_user_share.h" | |
6 | |
7 #include "base/compiler_specific.h" | |
8 #include "testing/gtest/include/gtest/gtest.h" | |
9 | |
10 namespace browser_sync { | |
11 | |
12 TestUserShare::TestUserShare() {} | |
13 | |
14 TestUserShare::~TestUserShare() { | |
15 if (user_share_.get()) | |
16 ADD_FAILURE() << "Should have called TestUserShare::TearDown()"; | |
17 } | |
18 | |
19 void TestUserShare::SetUp() { | |
20 user_share_.reset(new sync_api::UserShare()); | |
21 dir_maker_.SetUp(); | |
22 | |
23 // The pointer is owned by dir_maker_, we should not be storing it in a | |
24 // scoped_ptr. We must be careful to ensure the scoped_ptr never deletes it. | |
25 user_share_->directory.reset(dir_maker_.directory()); | |
26 } | |
27 | |
28 void TestUserShare::TearDown() { | |
29 // Ensure the scoped_ptr doesn't delete the memory we don't own. | |
30 ignore_result(user_share_->directory.release()); | |
31 | |
32 user_share_.reset(); | |
33 dir_maker_.TearDown(); | |
34 } | |
35 | |
36 sync_api::UserShare* TestUserShare::user_share() { | |
37 return user_share_.get(); | |
38 } | |
39 | |
40 } // namespace browser_sync | |
OLD | NEW |