Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: webkit/browser/fileapi/sandbox_prioritized_origin_database_unittest.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/platform_file.h" 8 #include "base/platform_file.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "webkit/browser/fileapi/sandbox_origin_database.h" 10 #include "webkit/browser/fileapi/sandbox_origin_database.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // Initialize paths for kOrigin1 and kOrigin2. 155 // Initialize paths for kOrigin1 and kOrigin2.
156 EXPECT_TRUE(database_old.GetPathForOrigin(kOrigin1, &path1)); 156 EXPECT_TRUE(database_old.GetPathForOrigin(kOrigin1, &path1));
157 EXPECT_FALSE(path1.empty()); 157 EXPECT_FALSE(path1.empty());
158 EXPECT_TRUE(database_old.GetPathForOrigin(kOrigin2, &path2)); 158 EXPECT_TRUE(database_old.GetPathForOrigin(kOrigin2, &path2));
159 EXPECT_FALSE(path2.empty()); 159 EXPECT_FALSE(path2.empty());
160 160
161 EXPECT_TRUE(base::DirectoryExists(old_db_path)); 161 EXPECT_TRUE(base::DirectoryExists(old_db_path));
162 162
163 // Populate the origin directory with some fake data. 163 // Populate the origin directory with some fake data.
164 old_dir_db_path1 = dir.path().Append(path1); 164 old_dir_db_path1 = dir.path().Append(path1);
165 ASSERT_TRUE(file_util::CreateDirectory(old_dir_db_path1)); 165 ASSERT_TRUE(base::CreateDirectory(old_dir_db_path1));
166 EXPECT_EQ(static_cast<int>(kFakeDirectoryData1.size()), 166 EXPECT_EQ(static_cast<int>(kFakeDirectoryData1.size()),
167 file_util::WriteFile(old_dir_db_path1.AppendASCII("dummy"), 167 file_util::WriteFile(old_dir_db_path1.AppendASCII("dummy"),
168 kFakeDirectoryData1.data(), 168 kFakeDirectoryData1.data(),
169 kFakeDirectoryData1.size())); 169 kFakeDirectoryData1.size()));
170 old_dir_db_path2 = dir.path().Append(path2); 170 old_dir_db_path2 = dir.path().Append(path2);
171 ASSERT_TRUE(file_util::CreateDirectory(old_dir_db_path2)); 171 ASSERT_TRUE(base::CreateDirectory(old_dir_db_path2));
172 EXPECT_EQ(static_cast<int>(kFakeDirectoryData2.size()), 172 EXPECT_EQ(static_cast<int>(kFakeDirectoryData2.size()),
173 file_util::WriteFile(old_dir_db_path2.AppendASCII("dummy"), 173 file_util::WriteFile(old_dir_db_path2.AppendASCII("dummy"),
174 kFakeDirectoryData2.data(), 174 kFakeDirectoryData2.data(),
175 kFakeDirectoryData2.size())); 175 kFakeDirectoryData2.size()));
176 } 176 }
177 177
178 // Re-open the directory using sandboxPrioritizedOriginDatabase. 178 // Re-open the directory using sandboxPrioritizedOriginDatabase.
179 SandboxPrioritizedOriginDatabase database(dir.path()); 179 SandboxPrioritizedOriginDatabase database(dir.path());
180 180
181 // Set the kOrigin1 as a parimary origin. 181 // Set the kOrigin1 as a parimary origin.
(...skipping 24 matching lines...) Expand all
206 EXPECT_TRUE(base::ReadFileToString( 206 EXPECT_TRUE(base::ReadFileToString(
207 dir_db_path.AppendASCII("dummy"), &origin_db_data)); 207 dir_db_path.AppendASCII("dummy"), &origin_db_data));
208 EXPECT_EQ(kFakeDirectoryData2, origin_db_data); 208 EXPECT_EQ(kFakeDirectoryData2, origin_db_data);
209 209
210 // After the migration the kOrigin1 directory database path must be gone. 210 // After the migration the kOrigin1 directory database path must be gone.
211 EXPECT_FALSE(base::PathExists(old_dir_db_path1)); 211 EXPECT_FALSE(base::PathExists(old_dir_db_path1));
212 EXPECT_TRUE(base::PathExists(old_dir_db_path2)); 212 EXPECT_TRUE(base::PathExists(old_dir_db_path2));
213 } 213 }
214 214
215 } // namespace fileapi 215 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/sandbox_origin_database_unittest.cc ('k') | webkit/browser/fileapi/test_file_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698