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

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

Issue 661503003: Revert of Eliminate silently letting errors pass on pak loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « ui/base/resource/resource_bundle_mac.mm ('k') | ui/base/ui_base_paths.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11a886654155f7045ea9e6bc37169d4a3380b76a..488947dbc8f8be5bb1067e830662b3c5b900d624 100644
--- a/ui/base/resource/resource_bundle_unittest.cc
+++ b/ui/base/resource/resource_bundle_unittest.cc
@@ -186,7 +186,7 @@
Property(&base::FilePath::value, pack_path.value()),
pack_scale_factor))
.Times(1)
- .WillOnce(Return(base::FilePath()));
+ .WillOnce(Return(pack_path));
resource_bundle->AddDataPackFromPath(pack_path, pack_scale_factor);
}
@@ -414,6 +414,7 @@
};
// Verify that we don't crash when trying to load a resource that is not found.
+// In some cases, we fail to mmap resources.pak, but try to keep going anyway.
TEST_F(ResourceBundleImageTest, LoadDataResourceBytes) {
base::FilePath data_path = dir_path().Append(FILE_PATH_LITERAL("sample.pak"));
@@ -426,6 +427,13 @@
resource_bundle->AddDataPackFromPath(data_path, SCALE_FACTOR_100P);
const int kUnfoundResourceId = 10000;
+ EXPECT_EQ(NULL, resource_bundle->LoadDataResourceBytes(
+ kUnfoundResourceId));
+
+ // Give a .pak file that doesn't exist so we will fail to load it.
+ resource_bundle->AddDataPackFromPath(
+ base::FilePath(FILE_PATH_LITERAL("non-existant-file.pak")),
+ ui::SCALE_FACTOR_NONE);
EXPECT_EQ(NULL, resource_bundle->LoadDataResourceBytes(
kUnfoundResourceId));
}
« no previous file with comments | « ui/base/resource/resource_bundle_mac.mm ('k') | ui/base/ui_base_paths.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698