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

Unified Diff: content/test/test_content_client.cc

Issue 1217063002: Have test_content_client look for .pak file in the .apk as well as on disk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_content_client.cc
diff --git a/content/test/test_content_client.cc b/content/test/test_content_client.cc
index 0ccc8cf5838c07d5861a0d8ff39181ee71571b18..70927fc3d872617e10f4549d55cf3edcaaad027f 100644
--- a/content/test/test_content_client.cc
+++ b/content/test/test_content_client.cc
@@ -10,6 +10,10 @@
#include "base/path_service.h"
#include "base/strings/string_piece.h"
+#if defined(OS_ANDROID)
+#include "base/android/apk_assets.h"
+#endif
+
namespace content {
TestContentClient::TestContentClient()
@@ -18,6 +22,14 @@ TestContentClient::TestContentClient()
#if !defined(OS_IOS)
base::FilePath content_shell_pack_path;
#if defined(OS_ANDROID)
+ base::MemoryMappedFile::Region region;
+ // Tests that don't yet use .isolate files require loading from within .apk.
+ int fd = base::android::OpenApkAsset("assets/content_shell.pak", &region);
+ if (fd >= 0) {
+ data_pack_.LoadFromFileRegion(base::File(fd), region);
+ return;
boliu 2015/06/29 20:24:32 This is making the structure here super brittle. E
agrieve 2015/06/29 20:38:04 Agree. Will address in a follow-up.
+ }
+
// on Android all pak files are inside the paks folder.
PathService::Get(base::DIR_ANDROID_APP_DATA, &content_shell_pack_path);
content_shell_pack_path = content_shell_pack_path.Append(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698