| OLD | NEW |
| 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 "net/disk_cache/simple/simple_version_upgrade.h" | 5 #include "net/disk_cache/simple/simple_version_upgrade.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
| 12 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 13 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 14 #include "net/disk_cache/simple/simple_backend_version.h" | 16 #include "net/disk_cache/simple/simple_backend_version.h" |
| 15 #include "net/disk_cache/simple/simple_entry_format_history.h" | 17 #include "net/disk_cache/simple/simple_entry_format_history.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 19 |
| 18 // The migration process relies on ability to rename newly created files, which | 20 // The migration process relies on ability to rename newly created files, which |
| 19 // could be problematic on Windows XP. | 21 // could be problematic on Windows XP. |
| 20 #if defined(OS_POSIX) | 22 #if defined(OS_POSIX) |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 | 25 |
| 24 // Same as |disk_cache::kSimpleInitialMagicNumber|. | 26 // Same as |disk_cache::kSimpleInitialMagicNumber|. |
| 25 const uint64 kSimpleInitialMagicNumber = GG_UINT64_C(0xfcfb6d1ba7725c30); | 27 const uint64 kSimpleInitialMagicNumber = UINT64_C(0xfcfb6d1ba7725c30); |
| 26 | 28 |
| 27 // The "fake index" file that cache backends use to distinguish whether the | 29 // The "fake index" file that cache backends use to distinguish whether the |
| 28 // cache belongs to one backend or another. | 30 // cache belongs to one backend or another. |
| 29 const char kFakeIndexFileName[] = "index"; | 31 const char kFakeIndexFileName[] = "index"; |
| 30 | 32 |
| 31 // Same as |SimpleIndexFile::kIndexFileName|. | 33 // Same as |SimpleIndexFile::kIndexFileName|. |
| 32 const char kIndexFileName[] = "the-real-index"; | 34 const char kIndexFileName[] = "the-real-index"; |
| 33 | 35 |
| 34 bool WriteFakeIndexFileV5(const base::FilePath& cache_path) { | 36 bool WriteFakeIndexFileV5(const base::FilePath& cache_path) { |
| 35 disk_cache::FakeIndexData data; | 37 disk_cache::FakeIndexData data; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 EXPECT_TRUE(base::ReadFileToString(cache_path.AppendASCII(file_name), | 133 EXPECT_TRUE(base::ReadFileToString(cache_path.AppendASCII(file_name), |
| 132 &real_contents)); | 134 &real_contents)); |
| 133 EXPECT_EQ(expected_contents, real_contents); | 135 EXPECT_EQ(expected_contents, real_contents); |
| 134 } | 136 } |
| 135 } | 137 } |
| 136 } | 138 } |
| 137 | 139 |
| 138 } // namespace | 140 } // namespace |
| 139 | 141 |
| 140 #endif // defined(OS_POSIX) | 142 #endif // defined(OS_POSIX) |
| OLD | NEW |