Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: ui/base/resource/resource_bundle_unittest.cc

Issue 2149323003: Change the way that gzipped resources are loaded from resources.pak (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/base/resource/resource_bundle_unittest.cc
diff --git a/ui/base/resource/resource_bundle_unittest.cc b/ui/base/resource/resource_bundle_unittest.cc
index f053f57d522d0e6e11ff7f95cb370dc27bc491b9..6ddf69a5a16e17f4a8b40f2f242ee617430082b4 100644
--- a/ui/base/resource/resource_bundle_unittest.cc
+++ b/ui/base/resource/resource_bundle_unittest.cc
@@ -271,44 +271,6 @@ TEST_F(ResourceBundleTest, DelegateLoadDataResourceBytes) {
EXPECT_EQ(static_memory, result);
}
-TEST_F(ResourceBundleTest, LoadDataResourceBytesGzip) {
- base::ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- base::FilePath data_path = dir.path().Append(FILE_PATH_LITERAL("sample.pak"));
-
- char kCompressedEntryPakContents[] = {
- 0x04u, 0x00u, 0x00u, 0x00u, // header(version
- 0x01u, 0x00u, 0x00u, 0x00u, // no. entries
- 0x01u, // encoding)
- 0x04u, 0x00u, 0x15u, 0x00u, 0x00u, 0x00u, // index entry 4
- 0x00u, 0x00u, 0x3bu, 0x00u, 0x00u,
- 0x00u, // extra entry for the size of last
- // Entry 4 is a compressed gzip file (with custom leading byte) saying:
- // "This is compressed\n"
- ResourceBundle::CUSTOM_GZIP_HEADER[0], 0x1fu, 0x8bu, 0x08u, 0x00u, 0x00u,
- 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, 0x0bu, 0xc9u, 0xc8u, 0x2cu, 0x56u,
- 0x00u, 0xa2u, 0xe4u, 0xfcu, 0xdcu, 0x82u, 0xa2u, 0xd4u, 0xe2u, 0xe2u,
- 0xd4u, 0x14u, 0x2eu, 0x00u, 0xd9u, 0xf8u, 0xc4u, 0x6fu, 0x13u, 0x00u,
- 0x00u, 0x00u};
-
- size_t compressed_entry_pak_size = sizeof(kCompressedEntryPakContents);
-
- // Dump contents into the pak file.
- ASSERT_EQ(base::WriteFile(data_path, kCompressedEntryPakContents,
- compressed_entry_pak_size), static_cast<int>(compressed_entry_pak_size));
-
- ResourceBundle* resource_bundle = CreateResourceBundle(nullptr);
- resource_bundle->AddDataPackFromPath(data_path, SCALE_FACTOR_NONE);
-
- // Load the compressed resource.
- scoped_refptr<base::RefCountedMemory> result =
- resource_bundle->LoadDataResourceBytes(4);
- EXPECT_EQ(
- strncmp("This is compressed\n",
- reinterpret_cast<const char*>(result->front()), result->size()),
- 0);
-}
-
TEST_F(ResourceBundleTest, DelegateGetRawDataResource) {
MockResourceBundleDelegate delegate;
ResourceBundle* resource_bundle = CreateResourceBundle(&delegate);
« content/public/browser/web_ui_data_source.h ('K') | « ui/base/resource/resource_bundle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698