OLD | NEW |
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 "apps/saved_files_service.h" | 5 #include "apps/saved_files_service.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_observer.h" | 9 #include "base/scoped_observer.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 }; | 83 }; |
84 | 84 |
85 protected: | 85 protected: |
86 base::FilePath TempFilePath(const std::string& destination_name, | 86 base::FilePath TempFilePath(const std::string& destination_name, |
87 bool copy_gold) { | 87 bool copy_gold) { |
88 if (!temp_dir_.CreateUniqueTempDir()) { | 88 if (!temp_dir_.CreateUniqueTempDir()) { |
89 ADD_FAILURE() << "CreateUniqueTempDir failed"; | 89 ADD_FAILURE() << "CreateUniqueTempDir failed"; |
90 return base::FilePath(); | 90 return base::FilePath(); |
91 } | 91 } |
92 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( | 92 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( |
93 "test_temp", temp_dir_.path()); | 93 "test_temp", temp_dir_.GetPath()); |
94 | 94 |
95 base::FilePath destination = temp_dir_.path().AppendASCII(destination_name); | 95 base::FilePath destination = |
| 96 temp_dir_.GetPath().AppendASCII(destination_name); |
96 if (copy_gold) { | 97 if (copy_gold) { |
97 base::FilePath source = test_root_folder_.AppendASCII("gold.txt"); | 98 base::FilePath source = test_root_folder_.AppendASCII("gold.txt"); |
98 EXPECT_TRUE(base::CopyFile(source, destination)); | 99 EXPECT_TRUE(base::CopyFile(source, destination)); |
99 } | 100 } |
100 return destination; | 101 return destination; |
101 } | 102 } |
102 | 103 |
103 std::vector<base::FilePath> TempFilePaths( | 104 std::vector<base::FilePath> TempFilePaths( |
104 const std::vector<std::string>& destination_names, | 105 const std::vector<std::string>& destination_names, |
105 bool copy_gold) { | 106 bool copy_gold) { |
106 if (!temp_dir_.CreateUniqueTempDir()) { | 107 if (!temp_dir_.CreateUniqueTempDir()) { |
107 ADD_FAILURE() << "CreateUniqueTempDir failed"; | 108 ADD_FAILURE() << "CreateUniqueTempDir failed"; |
108 return std::vector<base::FilePath>(); | 109 return std::vector<base::FilePath>(); |
109 } | 110 } |
110 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( | 111 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( |
111 "test_temp", temp_dir_.path()); | 112 "test_temp", temp_dir_.GetPath()); |
112 | 113 |
113 std::vector<base::FilePath> result; | 114 std::vector<base::FilePath> result; |
114 for (std::vector<std::string>::const_iterator it = | 115 for (std::vector<std::string>::const_iterator it = |
115 destination_names.begin(); | 116 destination_names.begin(); |
116 it != destination_names.end(); ++it) { | 117 it != destination_names.end(); ++it) { |
117 base::FilePath destination = temp_dir_.path().AppendASCII(*it); | 118 base::FilePath destination = temp_dir_.GetPath().AppendASCII(*it); |
118 if (copy_gold) { | 119 if (copy_gold) { |
119 base::FilePath source = test_root_folder_.AppendASCII("gold.txt"); | 120 base::FilePath source = test_root_folder_.AppendASCII("gold.txt"); |
120 EXPECT_TRUE(base::CopyFile(source, destination)); | 121 EXPECT_TRUE(base::CopyFile(source, destination)); |
121 } | 122 } |
122 result.push_back(destination); | 123 result.push_back(destination); |
123 } | 124 } |
124 return result; | 125 return result; |
125 } | 126 } |
126 | 127 |
127 void CheckStoredDirectoryMatches(const base::FilePath& filename) { | 128 void CheckStoredDirectoryMatches(const base::FilePath& filename) { |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 #if !defined(OS_CHROMEOS) | 639 #if !defined(OS_CHROMEOS) |
639 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, RequestFileSystem_NotChromeOS) { | 640 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, RequestFileSystem_NotChromeOS) { |
640 ASSERT_TRUE(RunPlatformAppTestWithFlags( | 641 ASSERT_TRUE(RunPlatformAppTestWithFlags( |
641 "api_test/file_system/request_file_system_not_chromeos", | 642 "api_test/file_system/request_file_system_not_chromeos", |
642 kFlagIgnoreManifestWarnings)) | 643 kFlagIgnoreManifestWarnings)) |
643 << message_; | 644 << message_; |
644 } | 645 } |
645 #endif | 646 #endif |
646 | 647 |
647 } // namespace extensions | 648 } // namespace extensions |
OLD | NEW |