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

Side by Side Diff: chrome/browser/chromeos/drive/file_system_util_unittest.cc

Issue 23462021: Move out Drive cache file path constants outside of file_system_util.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months 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
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/chromeos/drive/file_system_util.h" 5 #include "chrome/browser/chromeos/drive/file_system_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/md5.h" 10 #include "base/md5.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 TEST(FileSystemUtilTest, MigrateCacheFilesFromOldDirectories) { 183 TEST(FileSystemUtilTest, MigrateCacheFilesFromOldDirectories) {
184 base::ScopedTempDir temp_dir; 184 base::ScopedTempDir temp_dir;
185 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 185 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
186 186
187 const base::FilePath persistent_directory = 187 const base::FilePath persistent_directory =
188 temp_dir.path().AppendASCII("persistent"); 188 temp_dir.path().AppendASCII("persistent");
189 const base::FilePath tmp_directory = temp_dir.path().AppendASCII("tmp"); 189 const base::FilePath tmp_directory = temp_dir.path().AppendASCII("tmp");
190 const base::FilePath files_directory = 190 const base::FilePath files_directory =
191 temp_dir.path().Append(kCacheFileDirectory); 191 temp_dir.path().AppendASCII("files");
192 192
193 // Prepare directories. 193 // Prepare directories.
194 ASSERT_TRUE(file_util::CreateDirectory(persistent_directory)); 194 ASSERT_TRUE(file_util::CreateDirectory(persistent_directory));
195 ASSERT_TRUE(file_util::CreateDirectory(tmp_directory)); 195 ASSERT_TRUE(file_util::CreateDirectory(tmp_directory));
196 ASSERT_TRUE(file_util::CreateDirectory(files_directory)); 196 ASSERT_TRUE(file_util::CreateDirectory(files_directory));
197 197
198 // Put some files. 198 // Put some files.
199 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( 199 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(
200 persistent_directory.AppendASCII("foo.abc"), "foo")); 200 persistent_directory.AppendASCII("foo.abc"), "foo"));
201 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( 201 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(
202 tmp_directory.AppendASCII("bar.123"), "bar")); 202 tmp_directory.AppendASCII("bar.123"), "bar"));
203 203
204 // Migrate. 204 // Migrate.
205 MigrateCacheFilesFromOldDirectories(temp_dir.path()); 205 MigrateCacheFilesFromOldDirectories(temp_dir.path(),
206 FILE_PATH_LITERAL("files"));
206 207
207 EXPECT_FALSE(base::PathExists(persistent_directory)); 208 EXPECT_FALSE(base::PathExists(persistent_directory));
208 EXPECT_TRUE(base::PathExists(files_directory.AppendASCII("foo.abc"))); 209 EXPECT_TRUE(base::PathExists(files_directory.AppendASCII("foo.abc")));
209 EXPECT_TRUE(base::PathExists(files_directory.AppendASCII("bar.123"))); 210 EXPECT_TRUE(base::PathExists(files_directory.AppendASCII("bar.123")));
210 } 211 }
211 212
212 TEST(FileSystemUtilTest, NeedsNamespaceMigration) { 213 TEST(FileSystemUtilTest, NeedsNamespaceMigration) {
213 // Not Drive cases. 214 // Not Drive cases.
214 EXPECT_FALSE(NeedsNamespaceMigration( 215 EXPECT_FALSE(NeedsNamespaceMigration(
215 base::FilePath::FromUTF8Unsafe("/Downloads"))); 216 base::FilePath::FromUTF8Unsafe("/Downloads")));
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 330
330 base::FilePath path = temp_dir.path().AppendASCII("test.txt"); 331 base::FilePath path = temp_dir.path().AppendASCII("test.txt");
331 const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789"; 332 const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789";
332 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(path, kTestData)); 333 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(path, kTestData));
333 334
334 EXPECT_EQ(base::MD5String(kTestData), GetMd5Digest(path)); 335 EXPECT_EQ(base::MD5String(kTestData), GetMd5Digest(path));
335 } 336 }
336 337
337 } // namespace util 338 } // namespace util
338 } // namespace drive 339 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698