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

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

Issue 7779019: Removed sample.pak binary from checkout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated. Created 9 years, 4 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/data_pack_unittest.cc ('k') | ui/base/test/data/data_pack_unittest/sample.pak » ('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 9e4f12c4f418dfd197af1bed07d60ffd63625f07..1a9f92c97ddd6655cfd5900f3911506285d6a920 100644
--- a/ui/base/resource/resource_bundle_unittest.cc
+++ b/ui/base/resource/resource_bundle_unittest.cc
@@ -6,11 +6,16 @@
#include "base/base_paths.h"
#include "base/file_path.h"
+#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/scoped_temp_dir.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace ui {
+extern const char kSamplePakContents[];
+extern const size_t kSamplePakSize;
+
TEST(ResourceBundle, LoadDataResourceBytes) {
// 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
@@ -19,11 +24,15 @@ TEST(ResourceBundle, LoadDataResourceBytes) {
// On Windows, the default data is compiled into the binary so this does
// nothing.
- FilePath data_path;
- PathService::Get(base::DIR_SOURCE_ROOT, &data_path);
- data_path = data_path.Append(
- FILE_PATH_LITERAL("ui/base/test/data/data_pack_unittest/sample.pak"));
+ ScopedTempDir dir;
+ ASSERT_TRUE(dir.CreateUniqueTempDir());
+ FilePath data_path = dir.path().Append(FILE_PATH_LITERAL("sample.pak"));
+
+ // Dump contents into the pak file.
+ ASSERT_EQ(file_util::WriteFile(data_path, kSamplePakContents, kSamplePakSize),
+ static_cast<int>(kSamplePakSize));
+ // Create a resource bundle from the file.
resource_bundle.LoadTestResources(data_path);
const int kUnfoundResourceId = 10000;
« no previous file with comments | « ui/base/resource/data_pack_unittest.cc ('k') | ui/base/test/data/data_pack_unittest/sample.pak » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698