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/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.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/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 virtual void TearDown() OVERRIDE { | 35 virtual void TearDown() OVERRIDE { |
36 file_system_context_ = NULL; | 36 file_system_context_ = NULL; |
37 base::RunLoop().RunUntilIdle(); | 37 base::RunLoop().RunUntilIdle(); |
38 } | 38 } |
39 | 39 |
40 void CreateAndRegisterTemporaryFile( | 40 void CreateAndRegisterTemporaryFile( |
41 FileSystemURL* file_url, | 41 FileSystemURL* file_url, |
42 base::FilePath* file_path) { | 42 base::FilePath* file_path) { |
43 EXPECT_TRUE( | 43 EXPECT_TRUE(base::CreateTemporaryFileInDir(data_dir_.path(), file_path)); |
44 file_util::CreateTemporaryFileInDir(data_dir_.path(), file_path)); | |
45 IsolatedContext* isolated_context = IsolatedContext::GetInstance(); | 44 IsolatedContext* isolated_context = IsolatedContext::GetInstance(); |
46 std::string name = "tmp"; | 45 std::string name = "tmp"; |
47 std::string fsid = isolated_context->RegisterFileSystemForPath( | 46 std::string fsid = isolated_context->RegisterFileSystemForPath( |
48 kFileSystemTypeForTransientFile, | 47 kFileSystemTypeForTransientFile, |
49 *file_path, | 48 *file_path, |
50 &name); | 49 &name); |
51 ASSERT_TRUE(!fsid.empty()); | 50 ASSERT_TRUE(!fsid.empty()); |
52 base::FilePath virtual_path = isolated_context->CreateVirtualRootPath( | 51 base::FilePath virtual_path = isolated_context->CreateVirtualRootPath( |
53 fsid).AppendASCII(name); | 52 fsid).AppendASCII(name); |
54 *file_url = file_system_context_->CreateCrackedFileSystemURL( | 53 *file_url = file_system_context_->CreateCrackedFileSystemURL( |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 base::RunLoop().RunUntilIdle(); | 112 base::RunLoop().RunUntilIdle(); |
114 | 113 |
115 // Now the temporary file and the transient filesystem must be gone too. | 114 // Now the temporary file and the transient filesystem must be gone too. |
116 ASSERT_FALSE(base::PathExists(temp_path)); | 115 ASSERT_FALSE(base::PathExists(temp_path)); |
117 ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, | 116 ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
118 file_util()->GetFileInfo(NewOperationContext().get(), | 117 file_util()->GetFileInfo(NewOperationContext().get(), |
119 temp_url, &file_info, &path)); | 118 temp_url, &file_info, &path)); |
120 } | 119 } |
121 | 120 |
122 } // namespace fileapi | 121 } // namespace fileapi |
OLD | NEW |