| 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 "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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 // Put some files. | 200 // Put some files. |
| 201 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( | 201 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( |
| 202 persistent_directory.AppendASCII("foo.abc"), "foo")); | 202 persistent_directory.AppendASCII("foo.abc"), "foo")); |
| 203 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( | 203 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( |
| 204 tmp_directory.AppendASCII("bar.123"), "bar")); | 204 tmp_directory.AppendASCII("bar.123"), "bar")); |
| 205 | 205 |
| 206 // Migrate. | 206 // Migrate. |
| 207 MigrateCacheFilesFromOldDirectories(temp_dir.path()); | 207 MigrateCacheFilesFromOldDirectories(temp_dir.path()); |
| 208 | 208 |
| 209 EXPECT_FALSE(file_util::PathExists(persistent_directory)); | 209 EXPECT_FALSE(base::PathExists(persistent_directory)); |
| 210 EXPECT_TRUE(file_util::PathExists(files_directory.AppendASCII("foo.abc"))); | 210 EXPECT_TRUE(base::PathExists(files_directory.AppendASCII("foo.abc"))); |
| 211 EXPECT_TRUE(file_util::PathExists(files_directory.AppendASCII("bar.123"))); | 211 EXPECT_TRUE(base::PathExists(files_directory.AppendASCII("bar.123"))); |
| 212 } | 212 } |
| 213 | 213 |
| 214 TEST(FileSystemUtilTest, NeedsNamespaceMigration) { | 214 TEST(FileSystemUtilTest, NeedsNamespaceMigration) { |
| 215 // Not Drive cases. | 215 // Not Drive cases. |
| 216 EXPECT_FALSE(NeedsNamespaceMigration( | 216 EXPECT_FALSE(NeedsNamespaceMigration( |
| 217 base::FilePath::FromUTF8Unsafe("/Downloads"))); | 217 base::FilePath::FromUTF8Unsafe("/Downloads"))); |
| 218 EXPECT_FALSE(NeedsNamespaceMigration( | 218 EXPECT_FALSE(NeedsNamespaceMigration( |
| 219 base::FilePath::FromUTF8Unsafe("/Downloads/x"))); | 219 base::FilePath::FromUTF8Unsafe("/Downloads/x"))); |
| 220 EXPECT_FALSE(NeedsNamespaceMigration( | 220 EXPECT_FALSE(NeedsNamespaceMigration( |
| 221 base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); | 221 base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 331 |
| 332 base::FilePath path = temp_dir.path().AppendASCII("test.txt"); | 332 base::FilePath path = temp_dir.path().AppendASCII("test.txt"); |
| 333 const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789"; | 333 const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789"; |
| 334 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(path, kTestData)); | 334 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(path, kTestData)); |
| 335 | 335 |
| 336 EXPECT_EQ(base::MD5String(kTestData), GetMd5Digest(path)); | 336 EXPECT_EQ(base::MD5String(kTestData), GetMd5Digest(path)); |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace util | 339 } // namespace util |
| 340 } // namespace drive | 340 } // namespace drive |
| OLD | NEW |