| 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 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 | 1651 |
| 1652 if (test_case == CORRUPT_CACHE_ON_INSTALL || | 1652 if (test_case == CORRUPT_CACHE_ON_INSTALL || |
| 1653 test_case == CORRUPT_CACHE_ON_LOAD_EXISTING) { | 1653 test_case == CORRUPT_CACHE_ON_LOAD_EXISTING) { |
| 1654 // Create a corrupt/unopenable disk_cache index file. | 1654 // Create a corrupt/unopenable disk_cache index file. |
| 1655 const std::string kCorruptData("deadbeef"); | 1655 const std::string kCorruptData("deadbeef"); |
| 1656 base::FilePath disk_cache_directory = | 1656 base::FilePath disk_cache_directory = |
| 1657 temp_directory_.path().AppendASCII("Cache"); | 1657 temp_directory_.path().AppendASCII("Cache"); |
| 1658 ASSERT_TRUE(base::CreateDirectory(disk_cache_directory)); | 1658 ASSERT_TRUE(base::CreateDirectory(disk_cache_directory)); |
| 1659 base::FilePath index_file = disk_cache_directory.AppendASCII("index"); | 1659 base::FilePath index_file = disk_cache_directory.AppendASCII("index"); |
| 1660 EXPECT_EQ(static_cast<int>(kCorruptData.length()), | 1660 EXPECT_EQ(static_cast<int>(kCorruptData.length()), |
| 1661 file_util::WriteFile( | 1661 base::WriteFile( |
| 1662 index_file, kCorruptData.data(), kCorruptData.length())); | 1662 index_file, kCorruptData.data(), kCorruptData.length())); |
| 1663 } | 1663 } |
| 1664 | 1664 |
| 1665 // Create records for a degenerate cached manifest that only contains | 1665 // Create records for a degenerate cached manifest that only contains |
| 1666 // one entry for the manifest file resource. | 1666 // one entry for the manifest file resource. |
| 1667 if (test_case == CORRUPT_CACHE_ON_LOAD_EXISTING) { | 1667 if (test_case == CORRUPT_CACHE_ON_LOAD_EXISTING) { |
| 1668 AppCacheDatabase db(temp_directory_.path().AppendASCII("Index")); | 1668 AppCacheDatabase db(temp_directory_.path().AppendASCII("Index")); |
| 1669 GURL manifest_url = MockHttpServer::GetMockUrl("manifest"); | 1669 GURL manifest_url = MockHttpServer::GetMockUrl("manifest"); |
| 1670 | 1670 |
| 1671 AppCacheDatabase::GroupRecord group_record; | 1671 AppCacheDatabase::GroupRecord group_record; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); | 2000 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); |
| 2001 } | 2001 } |
| 2002 | 2002 |
| 2003 TEST_F(AppCacheStorageImplTest, Reinitialize3) { | 2003 TEST_F(AppCacheStorageImplTest, Reinitialize3) { |
| 2004 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); | 2004 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); |
| 2005 } | 2005 } |
| 2006 | 2006 |
| 2007 // That's all folks! | 2007 // That's all folks! |
| 2008 | 2008 |
| 2009 } // namespace appcache | 2009 } // namespace appcache |
| OLD | NEW |