| 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_cache.h" | 5 #include "chrome/browser/chromeos/drive/file_cache.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 | 911 |
| 912 // File with multiple extensions should be removed. | 912 // File with multiple extensions should be removed. |
| 913 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( | 913 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( |
| 914 file_directory.AppendASCII("id_kyu.md5.mounted"), "kyu (mounted)")); | 914 file_directory.AppendASCII("id_kyu.md5.mounted"), "kyu (mounted)")); |
| 915 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( | 915 ASSERT_TRUE(google_apis::test_util::WriteStringToFile( |
| 916 file_directory.AppendASCII("id_kyu.md5"), "kyu")); | 916 file_directory.AppendASCII("id_kyu.md5"), "kyu")); |
| 917 | 917 |
| 918 // Rename and verify the result. | 918 // Rename and verify the result. |
| 919 RenameCacheFilesToNewFormat(cache_.get()); | 919 RenameCacheFilesToNewFormat(cache_.get()); |
| 920 std::string contents; | 920 std::string contents; |
| 921 EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_koo"), | 921 EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_koo"), |
| 922 &contents)); | 922 &contents)); |
| 923 EXPECT_EQ("koo", contents); | 923 EXPECT_EQ("koo", contents); |
| 924 contents.clear(); | 924 contents.clear(); |
| 925 EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_kyu"), | 925 EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_kyu"), |
| 926 &contents)); | 926 &contents)); |
| 927 EXPECT_EQ("kyu", contents); | 927 EXPECT_EQ("kyu", contents); |
| 928 | 928 |
| 929 // Rename again. | 929 // Rename again. |
| 930 RenameCacheFilesToNewFormat(cache_.get()); | 930 RenameCacheFilesToNewFormat(cache_.get()); |
| 931 | 931 |
| 932 // Files with new style names are not affected. | 932 // Files with new style names are not affected. |
| 933 contents.clear(); | 933 contents.clear(); |
| 934 EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_koo"), | 934 EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_koo"), |
| 935 &contents)); | 935 &contents)); |
| 936 EXPECT_EQ("koo", contents); | 936 EXPECT_EQ("koo", contents); |
| 937 contents.clear(); | 937 contents.clear(); |
| 938 EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_kyu"), | 938 EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_kyu"), |
| 939 &contents)); | 939 &contents)); |
| 940 EXPECT_EQ("kyu", contents); | 940 EXPECT_EQ("kyu", contents); |
| 941 } | 941 } |
| 942 | 942 |
| 943 } // namespace internal | 943 } // namespace internal |
| 944 } // namespace drive | 944 } // namespace drive |
| OLD | NEW |