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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "content/public/test/test_file_system_context.h" | 11 #include "content/public/test/test_file_system_context.h" |
12 #include "storage/browser/fileapi/file_system_context.h" | 12 #include "storage/browser/fileapi/file_system_context.h" |
13 #include "storage/browser/fileapi/file_system_operation_context.h" | 13 #include "storage/browser/fileapi/file_system_operation_context.h" |
14 #include "storage/browser/fileapi/isolated_context.h" | 14 #include "storage/browser/fileapi/isolated_context.h" |
15 #include "storage/browser/fileapi/transient_file_util.h" | 15 #include "storage/browser/fileapi/transient_file_util.h" |
16 #include "storage/common/blob/scoped_file.h" | 16 #include "storage/common/blob/scoped_file.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 using storage::FileSystemURL; | 19 using storage::FileSystemURL; |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class TransientFileUtilTest : public testing::Test { | 23 class TransientFileUtilTest : public testing::Test { |
24 public: | 24 public: |
25 TransientFileUtilTest() {} | 25 TransientFileUtilTest() {} |
26 virtual ~TransientFileUtilTest() {} | 26 virtual ~TransientFileUtilTest() {} |
27 | 27 |
28 virtual void SetUp() OVERRIDE { | 28 virtual void SetUp() override { |
29 file_system_context_ = CreateFileSystemContextForTesting( | 29 file_system_context_ = CreateFileSystemContextForTesting( |
30 NULL, base::FilePath(FILE_PATH_LITERAL("dummy"))); | 30 NULL, base::FilePath(FILE_PATH_LITERAL("dummy"))); |
31 transient_file_util_.reset(new storage::TransientFileUtil); | 31 transient_file_util_.reset(new storage::TransientFileUtil); |
32 | 32 |
33 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 33 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
34 } | 34 } |
35 | 35 |
36 virtual void TearDown() OVERRIDE { | 36 virtual void TearDown() override { |
37 file_system_context_ = NULL; | 37 file_system_context_ = NULL; |
38 base::RunLoop().RunUntilIdle(); | 38 base::RunLoop().RunUntilIdle(); |
39 } | 39 } |
40 | 40 |
41 void CreateAndRegisterTemporaryFile( | 41 void CreateAndRegisterTemporaryFile( |
42 FileSystemURL* file_url, | 42 FileSystemURL* file_url, |
43 base::FilePath* file_path) { | 43 base::FilePath* file_path) { |
44 EXPECT_TRUE(base::CreateTemporaryFileInDir(data_dir_.path(), file_path)); | 44 EXPECT_TRUE(base::CreateTemporaryFileInDir(data_dir_.path(), file_path)); |
45 storage::IsolatedContext* isolated_context = | 45 storage::IsolatedContext* isolated_context = |
46 storage::IsolatedContext::GetInstance(); | 46 storage::IsolatedContext::GetInstance(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 base::RunLoop().RunUntilIdle(); | 111 base::RunLoop().RunUntilIdle(); |
112 | 112 |
113 // Now the temporary file and the transient filesystem must be gone too. | 113 // Now the temporary file and the transient filesystem must be gone too. |
114 ASSERT_FALSE(base::PathExists(temp_path)); | 114 ASSERT_FALSE(base::PathExists(temp_path)); |
115 ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND, | 115 ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND, |
116 file_util()->GetFileInfo(NewOperationContext().get(), | 116 file_util()->GetFileInfo(NewOperationContext().get(), |
117 temp_url, &file_info, &path)); | 117 temp_url, &file_info, &path)); |
118 } | 118 } |
119 | 119 |
120 } // namespace content | 120 } // namespace content |
OLD | NEW |