summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorqsr@chromium.org <qsr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-18 19:41:34 +0000
committerqsr@chromium.org <qsr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-18 19:41:34 +0000
commit3b8b8051ef4fd83ac817a897827659ec9859630b (patch)
tree104874fc73ef5f08a4edaee9264cbec3de641a30 /mojo
parentda9f30ae881fe63b37b17197d6a18b305d2154f8 (diff)
downloadchromium_src-3b8b8051ef4fd83ac817a897827659ec9859630b.zip
chromium_src-3b8b8051ef4fd83ac817a897827659ec9859630b.tar.gz
chromium_src-3b8b8051ef4fd83ac817a897827659ec9859630b.tar.bz2
Small fixes in mojo_shell for android.
R=viettrungluu@chromium.org Review URL: https://codereview.chromium.org/339943002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/mojo.gyp9
-rw-r--r--mojo/shell/mojo_url_resolver.cc9
-rw-r--r--mojo/shell/shell_test_base.cc11
3 files changed, 23 insertions, 6 deletions
diff --git a/mojo/mojo.gyp b/mojo/mojo.gyp
index e54f9a4..7a27b57 100644
--- a/mojo/mojo.gyp
+++ b/mojo/mojo.gyp
@@ -590,7 +590,7 @@
},
{
'target_name': 'mojo_shell_tests',
- 'type': 'executable',
+ 'type': '<(gtest_target_type)',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:test_support_base',
@@ -612,6 +612,13 @@
'shell/shell_test_base_unittest.cc',
'shell/shell_test_main.cc',
],
+ 'conditions': [
+ ['OS == "android"', {
+ 'dependencies': [
+ '../testing/android/native_test.gyp:native_test_native_code',
+ ],
+ }],
+ ],
},
{
'target_name': 'mojo_service_manager_unittests',
diff --git a/mojo/shell/mojo_url_resolver.cc b/mojo/shell/mojo_url_resolver.cc
index 9591b1d..3505954 100644
--- a/mojo/shell/mojo_url_resolver.cc
+++ b/mojo/shell/mojo_url_resolver.cc
@@ -18,7 +18,7 @@ namespace {
std::string MakeSharedLibraryName(const std::string& host_name) {
#if defined(OS_WIN)
return host_name + ".dll";
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_ANDROID)
return "lib" + host_name + ".so";
#elif defined(OS_MACOSX)
return "lib" + host_name + ".dylib";
@@ -57,10 +57,15 @@ GURL MojoURLResolver::Resolve(const GURL& mojo_url) const {
if (local_file_set_.find(mojo_url) != local_file_set_.end()) {
// Resolve to a local file URL.
base::FilePath path;
+#if defined(OS_ANDROID)
+ // On Android, additional lib are bundled.
+ PathService::Get(base::DIR_MODULE, &path);
+#else
PathService::Get(base::DIR_EXE, &path);
#if !defined(OS_WIN)
path = path.Append(FILE_PATH_LITERAL("lib"));
-#endif
+#endif // !defined(OS_WIN)
+#endif // defined(OS_ANDROID)
path = path.Append(base::FilePath::FromUTF8Unsafe(lib));
return net::FilePathToFileURL(path);
}
diff --git a/mojo/shell/shell_test_base.cc b/mojo/shell/shell_test_base.cc
index b4f0e4b..947e70e 100644
--- a/mojo/shell/shell_test_base.cc
+++ b/mojo/shell/shell_test_base.cc
@@ -8,6 +8,7 @@
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/logging.h"
+#include "base/path_service.h"
#include "build/build_config.h"
#include "mojo/shell/context.h"
#include "net/base/filename_util.h"
@@ -37,10 +38,14 @@ void ShellTestBase::LaunchServiceInProcess(
DCHECK(message_loop_);
DCHECK(shell_context_);
- base::FilePath base_dir = base::MakeAbsoluteFilePath(
- base::CommandLine::ForCurrentProcess()->GetProgram().DirName());
+ base::FilePath base_dir;
+ CHECK(PathService::Get(base::DIR_EXE, &base_dir));
+ // On android, the library is bundled with the app.
+#if defined(OS_ANDROID)
+ base::FilePath service_dir;
+ CHECK(PathService::Get(base::DIR_MODULE, &service_dir));
// On Mac and Windows, libraries are dumped beside the executables.
-#if defined(OS_MACOSX) || defined(OS_WIN)
+#elif defined(OS_MACOSX) || defined(OS_WIN)
base::FilePath service_dir(base_dir);
#else
// On Linux, they're under lib/.