OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 write_bytes_(0), | 53 write_bytes_(0), |
54 write_complete_(false), | 54 write_complete_(false), |
55 url_request_context_(file_system_.file_system_context()), | 55 url_request_context_(file_system_.file_system_context()), |
56 weak_factory_(this) {} | 56 weak_factory_(this) {} |
57 | 57 |
58 virtual void SetUp() OVERRIDE { | 58 virtual void SetUp() OVERRIDE { |
59 ASSERT_TRUE(dir_.CreateUniqueTempDir()); | 59 ASSERT_TRUE(dir_.CreateUniqueTempDir()); |
60 file_system_.SetUp(); | 60 file_system_.SetUp(); |
61 sync_context_ = new LocalFileSyncContext(base::MessageLoopProxy::current(), | 61 sync_context_ = new LocalFileSyncContext(base::MessageLoopProxy::current(), |
62 base::MessageLoopProxy::current()); | 62 base::MessageLoopProxy::current()); |
63 ASSERT_EQ(SYNC_STATUS_OK, | 63 ASSERT_EQ( |
64 file_system_.MaybeInitializeFileSystemContext(sync_context_)); | 64 SYNC_STATUS_OK, |
| 65 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); |
65 | 66 |
66 ASSERT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem()); | 67 ASSERT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem()); |
67 ASSERT_EQ(base::PLATFORM_FILE_OK, | 68 ASSERT_EQ(base::PLATFORM_FILE_OK, |
68 file_system_.CreateDirectory(URL(kParent))); | 69 file_system_.CreateDirectory(URL(kParent))); |
69 } | 70 } |
70 | 71 |
71 virtual void TearDown() OVERRIDE { | 72 virtual void TearDown() OVERRIDE { |
72 if (sync_context_) | 73 if (sync_context_.get()) |
73 sync_context_->ShutdownOnUIThread(); | 74 sync_context_->ShutdownOnUIThread(); |
74 sync_context_ = NULL; | 75 sync_context_ = NULL; |
75 | 76 |
76 file_system_.TearDown(); | 77 file_system_.TearDown(); |
77 message_loop_.RunUntilIdle(); | 78 message_loop_.RunUntilIdle(); |
78 RevokeSyncableFileSystem(kServiceName); | 79 RevokeSyncableFileSystem(kServiceName); |
79 } | 80 } |
80 | 81 |
81 FileSystemURL URL(const std::string& path) { | 82 FileSystemURL URL(const std::string& path) { |
82 return file_system_.URL(path); | 83 return file_system_.URL(path); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // Now the file must have been created and have the same content as temp_path. | 363 // Now the file must have been created and have the same content as temp_path. |
363 ResetCallbackStatus(); | 364 ResetCallbackStatus(); |
364 file_system_.DoVerifyFile( | 365 file_system_.DoVerifyFile( |
365 URL(kFile), kTestData, | 366 URL(kFile), kTestData, |
366 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); | 367 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); |
367 base::MessageLoop::current()->RunUntilIdle(); | 368 base::MessageLoop::current()->RunUntilIdle(); |
368 EXPECT_EQ(1, callback_count_); | 369 EXPECT_EQ(1, callback_count_); |
369 } | 370 } |
370 | 371 |
371 } // namespace sync_file_system | 372 } // namespace sync_file_system |
OLD | NEW |