| 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 <stack> | 5 #include <stack> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 } | 1627 } |
| 1628 | 1628 |
| 1629 void Reinitialize(int test_case) { | 1629 void Reinitialize(int test_case) { |
| 1630 // Unlike all of the other tests, this one actually read/write files. | 1630 // Unlike all of the other tests, this one actually read/write files. |
| 1631 ASSERT_TRUE(temp_directory_.CreateUniqueTempDir()); | 1631 ASSERT_TRUE(temp_directory_.CreateUniqueTempDir()); |
| 1632 | 1632 |
| 1633 // Create a corrupt/unopenable disk_cache index file. | 1633 // Create a corrupt/unopenable disk_cache index file. |
| 1634 const std::string kCorruptData("deadbeef"); | 1634 const std::string kCorruptData("deadbeef"); |
| 1635 base::FilePath disk_cache_directory = | 1635 base::FilePath disk_cache_directory = |
| 1636 temp_directory_.path().AppendASCII("Cache"); | 1636 temp_directory_.path().AppendASCII("Cache"); |
| 1637 ASSERT_TRUE(file_util::CreateDirectory(disk_cache_directory)); | 1637 ASSERT_TRUE(base::CreateDirectory(disk_cache_directory)); |
| 1638 base::FilePath index_file = disk_cache_directory.AppendASCII("index"); | 1638 base::FilePath index_file = disk_cache_directory.AppendASCII("index"); |
| 1639 EXPECT_EQ(static_cast<int>(kCorruptData.length()), | 1639 EXPECT_EQ(static_cast<int>(kCorruptData.length()), |
| 1640 file_util::WriteFile( | 1640 file_util::WriteFile( |
| 1641 index_file, kCorruptData.data(), kCorruptData.length())); | 1641 index_file, kCorruptData.data(), kCorruptData.length())); |
| 1642 | 1642 |
| 1643 // Create records for a degenerate cached manifest that only contains | 1643 // Create records for a degenerate cached manifest that only contains |
| 1644 // one entry for the manifest file resource. | 1644 // one entry for the manifest file resource. |
| 1645 if (test_case == 2) { | 1645 if (test_case == 2) { |
| 1646 AppCacheDatabase db(temp_directory_.path().AppendASCII("Index")); | 1646 AppCacheDatabase db(temp_directory_.path().AppendASCII("Index")); |
| 1647 GURL manifest_url = MockHttpServer::GetMockUrl("manifest"); | 1647 GURL manifest_url = MockHttpServer::GetMockUrl("manifest"); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1959 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize1); | 1959 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize1); |
| 1960 } | 1960 } |
| 1961 | 1961 |
| 1962 TEST_F(AppCacheStorageImplTest, Reinitialize2) { | 1962 TEST_F(AppCacheStorageImplTest, Reinitialize2) { |
| 1963 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); | 1963 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); |
| 1964 } | 1964 } |
| 1965 | 1965 |
| 1966 // That's all folks! | 1966 // That's all folks! |
| 1967 | 1967 |
| 1968 } // namespace appcache | 1968 } // namespace appcache |
| OLD | NEW |