From d14c7ac0a14a2dc3984022aeadf830a3e30c99f3 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Fri, 29 May 2009 20:38:11 +0000 Subject: Remove code path that passes a file handle to the renderer Since the code now does range request without any caching the code path for passing file handle is not used any more. Changes: 1. Remove response_data_file in webkit_glue::ResourceResponseHead 2. Remove response_data_file in net::ResourceInfo 3. Remove code that passes file handle using IPC 4. Remove code that passes file hadnle from network layer to ResourceDispatcherHost 5. Remove MediaResourceHandler 6. Remove code in disk_cache that expose the file handle 7. Remove ChromeURLRequestContext::CreateOffTheRecordForMedia() so no more OTR request context for media, in OTR mode simply memory cache is used 8. Reset cache size for media cache to default BUG=12249 BUG=12256 Review URL: http://codereview.chromium.org/113931 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17227 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/entry_unittest.cc | 99 ---------------------------------------- 1 file changed, 99 deletions(-) (limited to 'net/disk_cache/entry_unittest.cc') diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index a79b3f7..e48acb5 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc @@ -832,102 +832,3 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyDoomedEntry) { InitCache(); DoomEntry(); } - -// Check that we can hint an entry to use external file and the return value -// is a valid file handle. -TEST_F(DiskCacheEntryTest, UseExternalFile) { - InitCache(); - - disk_cache::Entry* entry; - ASSERT_TRUE(cache_->CreateEntry("key", &entry)); - base::PlatformFile cache_file = entry->UseExternalFile(0); - - // We should have a valid file handle. - EXPECT_NE(base::kInvalidPlatformFileValue, cache_file); - scoped_refptr file(new disk_cache::File(cache_file)); - - // 4KB. - size_t kDataSize = 0x1000; - scoped_refptr buffer = new net::IOBuffer(kDataSize); - - CacheTestFillBuffer(buffer->data(), kDataSize, false); - ASSERT_EQ(0U, file->GetLength()); - ASSERT_EQ(kDataSize, static_cast( - entry->WriteData(0, 0, buffer, kDataSize, NULL, false))); - ASSERT_EQ(kDataSize, file->GetLength()); - entry->Close(); -} - -// Make sure we can use Entry::GetPlatformFile on an entry stored in an external -// file and get a valid file handle. -TEST_F(DiskCacheEntryTest, GetPlatformFile) { - InitCache(); - - disk_cache::Entry* entry; - ASSERT_TRUE(cache_->CreateEntry("key", &entry)); - EXPECT_NE(base::kInvalidPlatformFileValue, entry->UseExternalFile(0)); - - size_t kDataSize = 50; - scoped_refptr buffer = new net::IOBuffer(kDataSize); - - // Fill the data buffer and write it to cache. - CacheTestFillBuffer(buffer->data(), kDataSize, false); - ASSERT_EQ(kDataSize,static_cast( - entry->WriteData(0, 0, buffer, kDataSize, NULL, false))); - - // Close the entry. - entry->Close(); - - // Open the entry again and get it's file handle. - ASSERT_TRUE(cache_->OpenEntry("key", &entry)); - base::PlatformFile cache_file = entry->GetPlatformFile(0); - - // Make sure it's a valid file handle and verify the size of the file. - scoped_refptr file(new disk_cache::File(cache_file)); - ASSERT_EQ(kDataSize, file->GetLength()); - - entry->Close(); -} - -// Test the behavior of EntryImpl that small entries are kept in block files -// or buffer, and only entries above certain size would be stored in an -// external file, make sure GetPlatformFile() works with both cases without -// using UseExternalFile(). -TEST_F(DiskCacheEntryTest, GetPlatformFileVariableEntrySize) { - InitCache(); - - disk_cache::Entry* entry; - - // Make the buffer just larger than disk_cache::kMaxBlockSize. - const size_t kLargeDataSize = disk_cache::kMaxBlockSize + 1; - const size_t kSmallDataSize = kLargeDataSize / 2; - scoped_refptr buffer = new net::IOBuffer(kLargeDataSize); - - // 1. First test with small entry. - ASSERT_TRUE(cache_->CreateEntry("small_entry", &entry)); - - CacheTestFillBuffer(buffer->data(), kSmallDataSize, false); - ASSERT_EQ(kSmallDataSize, static_cast( - entry->WriteData(0, 0, buffer, kSmallDataSize, NULL, false))); - - // Make sure we don't get an external file. - ASSERT_EQ(base::kInvalidPlatformFileValue, entry->GetPlatformFile(0)); - - entry->Close(); - - // 2. Test with large entry. - ASSERT_TRUE(cache_->CreateEntry("large_entry", &entry)); - - CacheTestFillBuffer(buffer->data(), kLargeDataSize, false); - ASSERT_EQ(kLargeDataSize, static_cast( - entry->WriteData(0, 0, buffer, kLargeDataSize, NULL, false))); - - base::PlatformFile cache_file = entry->GetPlatformFile(0); - EXPECT_NE(base::kInvalidPlatformFileValue, cache_file); - - // Make sure it's a valid file handle and verify the size of the file. - scoped_refptr file(new disk_cache::File(cache_file)); - ASSERT_EQ(kLargeDataSize, file->GetLength()); - - entry->Close(); -} -- cgit v1.1