summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authornileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-28 23:20:06 +0000
committernileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-28 23:20:06 +0000
commit5844ab0c6a41cc9d306f8c355cc7ceb5e290cbb1 (patch)
tree09dcb390edb2f9ffabde598a9c7d818231fe21c5 /content
parent2d3fe6aa560d4726575a6b8d32102597511f50bf (diff)
downloadchromium_src-5844ab0c6a41cc9d306f8c355cc7ceb5e290cbb1.zip
chromium_src-5844ab0c6a41cc9d306f8c355cc7ceb5e290cbb1.tar.gz
chromium_src-5844ab0c6a41cc9d306f8c355cc7ceb5e290cbb1.tar.bz2
Revert 179189
Failed to rename package name in buildbot scripts. Broke buildbots. > Add apk for running content_browsertests > > Split off org.chromium.content_shell into: > org.chromium.content_shell - content shell java code, builds a jar, directory structure similar to other jar targets > org.chromium.content_shell_apk - application code to build content_shell_apk, directory structure similar to that of android application > org.chromium.content_browsertests_apk - application code to build content_browsertests_apk > > Also splitting content/shell/android/res into: > - content/shell/android/java/res > - content/shell/android/shell_apk/res > > Both content_shell_apk and content_browsertests_apk will depend on content_shell_java target to include java/res needed to show a shell based browser. > > I will do another CL to move The java files for content_shell_tests_apk to content_shell_apk package. > > BUG=138275 > > > Review URL: https://chromiumcodereview.appspot.com/12047068 TBR=nileshagrawal@chromium.org Review URL: https://codereview.chromium.org/12088031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/content.gyp1
-rw-r--r--content/content_shell.gypi46
-rw-r--r--content/content_tests.gypi31
-rw-r--r--content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java4
-rw-r--r--content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java1
-rw-r--r--content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java2
-rw-r--r--content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java2
-rw-r--r--content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java2
-rw-r--r--content/public/test/content_test_suite_base.cc17
-rw-r--r--content/shell/android/browsertests_apk/AndroidManifest.xml72
-rw-r--r--content/shell/android/browsertests_apk/content_browser_tests_android.cc127
-rw-r--r--content/shell/android/browsertests_apk/res/layout/test_activity.xml14
-rw-r--r--content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java46
-rw-r--r--content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsApplication.java31
-rw-r--r--content/shell/android/java/AndroidManifest.xml (renamed from content/shell/android/shell_apk/AndroidManifest.xml)2
-rw-r--r--content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java (renamed from content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java)7
-rw-r--r--content/shell/android/java/src/org/chromium/content_shell/ContentShellApplication.java (renamed from content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellApplication.java)2
-rw-r--r--content/shell/android/java/src/org/chromium/content_shell/ShellManager.java5
-rw-r--r--content/shell/android/javatests/AndroidManifest.xml6
-rw-r--r--content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java1
-rw-r--r--content/shell/android/javatests/src/org/chromium/content_shell/ContentShellUrlTest.java1
-rw-r--r--content/shell/android/res/drawable/progress.xml (renamed from content/shell/android/java/res/drawable/progress.xml)0
-rw-r--r--content/shell/android/res/layout/content_shell_activity.xml (renamed from content/shell/android/shell_apk/res/layout/content_shell_activity.xml)0
-rw-r--r--content/shell/android/res/layout/shell_view.xml (renamed from content/shell/android/java/res/layout/shell_view.xml)0
-rw-r--r--content/shell/android/res/values/strings.xml (renamed from content/shell/android/java/res/values/strings.xml)0
-rw-r--r--content/shell/android/shell_jni_registrar.cc30
-rw-r--r--content/shell/android/shell_jni_registrar.h19
-rw-r--r--content/shell/android/shell_library_loader.cc14
-rw-r--r--content/test/content_test_launcher.cc19
-rw-r--r--content/test/run_all_unittests.cc18
30 files changed, 67 insertions, 453 deletions
diff --git a/content/content.gyp b/content/content.gyp
index d15f86f..0155546 100644
--- a/content/content.gyp
+++ b/content/content.gyp
@@ -290,7 +290,6 @@
'type': 'none',
'dependencies': [
'../base/base.gyp:base',
- '../media/media.gyp:media_java',
'../net/net.gyp:net',
'../ui/ui.gyp:ui_java',
'common_aidl',
diff --git a/content/content_shell.gypi b/content/content_shell.gypi
index 126c82f..62129cb 100644
--- a/content/content_shell.gypi
+++ b/content/content_shell.gypi
@@ -53,10 +53,6 @@
'..',
],
'sources': [
- 'shell/android/shell_jni_registrar.cc',
- 'shell/android/shell_jni_registrar.h',
- 'shell/android/shell_manager.cc',
- 'shell/android/shell_manager.h',
'shell/geolocation/shell_access_token_store.cc',
'shell/geolocation/shell_access_token_store.h',
'shell/minimal_ash.cc',
@@ -562,7 +558,6 @@
'target_name': 'content_shell_jni_headers',
'type': 'none',
'sources': [
- 'shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java',
'shell/android/java/src/org/chromium/content_shell/ShellManager.java',
'shell/android/java/src/org/chromium/content_shell/Shell.java',
],
@@ -591,6 +586,12 @@
'sources': [
'shell/android/shell_library_loader.cc',
'shell/android/shell_library_loader.h',
+ 'shell/android/shell_manager.cc',
+ 'shell/android/shell_manager.h',
+ ],
+ 'sources!': [
+ 'shell/shell_main.cc',
+ 'shell/shell_main.h',
],
'conditions': [
['android_build_type==1', {
@@ -601,27 +602,11 @@
],
},
{
- 'target_name': 'content_shell_java',
- 'type': 'none',
- 'dependencies': [
- 'content_java',
- ],
- 'variables': {
- 'package_name': 'content_shell',
- 'java_in_dir': '../content/shell/android/java',
- 'has_java_resources': 1,
- 'R_package': 'org.chromium.content_shell',
- 'R_package_relpath': 'org/chromium/content_shell',
- },
- 'includes': [ '../build/java.gypi' ],
- },
- {
# content_shell_apk creates a .jar as a side effect. Any java targets
# that need that .jar in their classpath should depend on this target,
- # content_shell_apk_java. Dependents of content_shell_apk receive its
- # jar path in the variable 'apk_output_jar_path'. This target should
- # only be used by targets which instrument content_shell_apk.
- 'target_name': 'content_shell_apk_java',
+ # content_shell_java. Dependents of content_shell_apk receive its jar
+ # path in the variable 'apk_output_jar_path'.
+ 'target_name': 'content_shell_java',
'type': 'none',
'dependencies': [
'content_shell_apk',
@@ -650,22 +635,21 @@
'type': 'none',
'dependencies': [
'content_java',
- 'content_shell_java',
- 'libcontent_shell_content_view',
'../base/base.gyp:base_java',
'../media/media.gyp:media_java',
'../net/net.gyp:net_java',
'../ui/ui.gyp:ui_java',
],
'variables': {
- 'package_name': 'content_shell_apk',
+ 'package_name': 'content_shell',
'apk_name': 'ContentShell',
- 'manifest_package_name': 'org.chromium.content_shell_apk',
- 'java_in_dir': 'shell/android/shell_apk',
- 'resource_dir': 'res',
+ 'manifest_package_name': 'org.chromium.content_shell',
+ 'java_in_dir': 'shell/android/java',
+ # TODO(cjhopman): The resource directory of all apks should be in
+ # <java_in_dir>/res.
+ 'resource_dir': '../res',
'native_libs_paths': ['<(SHARED_LIB_DIR)/libcontent_shell_content_view.so'],
'additional_input_paths': ['<(PRODUCT_DIR)/content_shell/assets/content_shell.pak'],
- 'asset_location': '<(ant_build_out)/content_shell/assets',
},
'includes': [ '../build/java_apk.gypi' ],
},
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 03e70d0..776c6be 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -818,11 +818,13 @@
'common/content_constants_internal.h',
],
'sources': [
- 'shell/android/browsertests_apk/content_browser_tests_android.cc',
+ 'shell/android/shell_library_loader.cc',
+ 'shell/android/shell_library_loader.cc',
+ 'shell/android/shell_manager.cc',
+ 'shell/android/shell_manager.h',
],
'dependencies': [
'content_shell_jni_headers',
- 'content_shell_lib',
],
}],
['OS=="mac"', {
@@ -961,25 +963,6 @@
},
'includes': [ '../build/apk_test.gypi' ],
},
- {
- 'target_name': 'content_browsertests_apk',
- 'type': 'none',
- 'dependencies': [
- 'content_browsertests',
- 'content_java',
- 'content_shell_java',
- ],
- 'variables': {
- 'package_name': 'content_browsertests_apk',
- 'apk_name': 'content_browsertests',
- 'java_in_dir': 'shell/android/browsertests_apk',
- 'resource_dir': 'res',
- 'native_libs_paths': ['<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)content_browsertests<(SHARED_LIB_SUFFIX)'],
- 'additional_input_paths': ['<(PRODUCT_DIR)/content_shell/assets/content_shell.pak'],
- 'asset_location': '<(ant_build_out)/content_shell/assets',
- },
- 'includes': [ '../build/java_apk.gypi' ],
- },
],
}],
['OS == "android"', {
@@ -1005,7 +988,7 @@
'dependencies': [
'content_java',
'content_java_test_support',
- 'content_shell_apk_java',
+ 'content_shell_java',
'../base/base.gyp:base_java',
'../base/base.gyp:base_java_test_support',
'../media/media.gyp:media_java',
@@ -1018,8 +1001,8 @@
'package_name': 'content_shell_test',
'apk_name': 'ContentShellTest',
'java_in_dir': '../content/shell/android/javatests',
- 'additional_src_dirs': ['../content/public/android/javatests/',],
- 'resource_dir': '../shell_apk/res',
+ 'resource_dir': '../res',
+ 'additional_src_dirs': ['../content/public/android/javatests/'],
'is_test_apk': 1,
},
'includes': [ '../build/java_apk.gypi' ],
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java b/content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java
index 96015f9..b84f7b8 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java
@@ -12,8 +12,8 @@ import org.chromium.base.test.util.Feature;
import org.chromium.content.app.LibraryLoader;
import org.chromium.content.common.CommandLine;
import org.chromium.content.common.ProcessInitException;
-import org.chromium.content_shell_apk.ContentShellActivity;
-import org.chromium.content_shell_apk.ContentShellApplication;
+import org.chromium.content_shell.ContentShellActivity;
+import org.chromium.content_shell.ContentShellApplication;
public class CommandLineTest extends InstrumentationTestCase {
// A reference command line. Note that switch2 is [brea\d], switch3 is [and "butter"],
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java
index a54c551..d07c514 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java
@@ -15,6 +15,7 @@ import org.chromium.content.browser.test.util.JavaScriptUtils;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnStartContentIntentHelper;
+import org.chromium.content_shell.ContentShellActivity;
import org.chromium.content_shell.ContentShellTestBase;
/**
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java
index a95165f..66d7f62 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java
@@ -7,8 +7,8 @@ package org.chromium.content.browser;
import android.util.Log;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
+import org.chromium.content_shell.ContentShellActivity;
import org.chromium.content_shell.ContentShellTestBase;
-import org.chromium.content_shell_apk.ContentShellActivity;
public class ContentViewTestBase extends ContentShellTestBase {
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java b/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java
index 7ad9162..177fa6e 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java
@@ -12,8 +12,8 @@ import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.TouchCommon;
import org.chromium.content.browser.test.util.UiUtils;
+import org.chromium.content_shell.ContentShellActivity;
import org.chromium.content_shell.ContentShellTestBase;
-import org.chromium.content_shell_apk.ContentShellActivity;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java b/content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java
index 836db69..d223b60 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java
@@ -8,8 +8,8 @@ import android.test.suitebuilder.annotation.MediumTest;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
+import org.chromium.content_shell.ContentShellActivity;
import org.chromium.content_shell.ContentShellTestBase;
-import org.chromium.content_shell_apk.ContentShellActivity;
/**
* Tests for various aspects of navigation.
diff --git a/content/public/test/content_test_suite_base.cc b/content/public/test/content_test_suite_base.cc
index 7c8c4d3..0c32858 100644
--- a/content/public/test/content_test_suite_base.cc
+++ b/content/public/test/content_test_suite_base.cc
@@ -15,14 +15,6 @@
#include "ui/base/ui_base_paths.h"
#include "ui/compositor/compositor_setup.h"
-#if defined(OS_ANDROID)
-#include "base/android/jni_android.h"
-#include "content/browser/android/browser_jni_registrar.h"
-#include "content/common/android/common_jni_registrar.h"
-#include "net/android/net_jni_registrar.h"
-#include "ui/android/ui_jni_registrar.h"
-#endif
-
namespace content {
ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv)
@@ -33,15 +25,6 @@ ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv)
void ContentTestSuiteBase::Initialize() {
base::TestSuite::Initialize();
-#if defined(OS_ANDROID)
- // Register JNI bindings for android.
- JNIEnv* env = base::android::AttachCurrentThread();
- content::android::RegisterCommonJni(env);
- content::android::RegisterBrowserJni(env);
- net::android::RegisterJni(env);
- ui::android::RegisterJni(env);
-#endif
-
if (external_libraries_enabled_)
media::InitializeMediaLibraryForTesting();
diff --git a/content/shell/android/browsertests_apk/AndroidManifest.xml b/content/shell/android/browsertests_apk/AndroidManifest.xml
deleted file mode 100644
index 5746a43..0000000
--- a/content/shell/android/browsertests_apk/AndroidManifest.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (c) 2012 The Chromium Authors. All rights reserved.
-
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.chromium.content_browsertests_apk">
-
- <permission android:name="org.chromium.content_shell.permission.SANDBOX"
- android:protectionLevel="signature" />
-
- <application android:name="ContentBrowserTestsApplication"
- android:label="ContentBrowserTests">
- <activity android:name="ContentBrowserTestsActivity"
- android:launchMode="singleTask"
- android:theme="@android:style/Theme.Holo.Light.NoActionBar"
- android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
- android:hardwareAccelerated="true">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- <!-- The following service entries exist in order to allow us to
- start more than one sandboxed process. -->
-
- <!-- NOTE: If you change the values of "android:process" for any of the below services,
- you also need to update kHelperProcessExecutableName in chrome_constants.cc. -->
- <service android:name="org.chromium.content.app.SandboxedProcessService0"
- android:process=":sandboxed_process0"
- android:permission="org.chromium.content_shell.permission.SANDBOX"
- android:isolatedProcess="true"
- android:exported="false" />
- <service android:name="org.chromium.content.app.SandboxedProcessService1"
- android:process=":sandboxed_process1"
- android:permission="org.chromium.content_shell.permission.SANDBOX"
- android:isolatedProcess="true"
- android:exported="false" />
- <service android:name="org.chromium.content.app.SandboxedProcessService2"
- android:process=":sandboxed_process2"
- android:permission="org.chromium.content_shell.permission.SANDBOX"
- android:isolatedProcess="true"
- android:exported="false" />
- <service android:name="org.chromium.content.app.SandboxedProcessService3"
- android:process=":sandboxed_process3"
- android:permission="org.chromium.content_shell.permission.SANDBOX"
- android:isolatedProcess="true"
- android:exported="false" />
- <service android:name="org.chromium.content.app.SandboxedProcessService4"
- android:process=":sandboxed_process4"
- android:permission="org.chromium.content_shell.permission.SANDBOX"
- android:isolatedProcess="true"
- android:exported="false" />
- <service android:name="org.chromium.content.app.SandboxedProcessService5"
- android:process=":sandboxed_process5"
- android:permission="org.chromium.content_shell.permission.SANDBOX"
- android:isolatedProcess="true"
- android:exported="false" />
- </application>
-
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.VIBRATE"/>
- <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
- <uses-permission android:name="android.permission.WAKE_LOCK"/>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-</manifest>
diff --git a/content/shell/android/browsertests_apk/content_browser_tests_android.cc b/content/shell/android/browsertests_apk/content_browser_tests_android.cc
deleted file mode 100644
index 4ed222d4..0000000
--- a/content/shell/android/browsertests_apk/content_browser_tests_android.cc
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This class sets up the environment for running the content browser tests
-// inside an android application.
-
-#include <android/log.h>
-
-#include "base/android/base_jni_registrar.h"
-#include "base/android/jni_android.h"
-#include "base/android/jni_string.h"
-#include "base/android/scoped_java_ref.h"
-#include "base/base_switches.h"
-#include "base/command_line.h"
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/string_tokenizer.h"
-#include "base/string_util.h"
-#include "base/stringprintf.h"
-#include "content/public/app/android_library_loader_hooks.h"
-#include "content/shell/android/shell_jni_registrar.h"
-#include "jni/ContentBrowserTestsActivity_jni.h"
-
-// The main function of the program to be wrapped as an apk.
-extern int main(int argc, char** argv);
-
-namespace {
-
-void ParseArgsFromString(const std::string& command_line,
- std::vector<std::string>* args) {
- StringTokenizer tokenizer(command_line, kWhitespaceASCII);
- tokenizer.set_quote_chars("\"");
- while (tokenizer.GetNext()) {
- std::string token;
- RemoveChars(tokenizer.token(), "\"", &token);
- args->push_back(token);
- }
-}
-
-void ParseArgsFromCommandLineFile(std::vector<std::string>* args) {
- // The test runner script writes the command line file in
- // "/data/local/tmp".
- static const char kCommandLineFilePath[] =
- "/data/local/tmp/content-browser-tests-command-line";
- FilePath command_line(kCommandLineFilePath);
- std::string command_line_string;
- if (file_util::ReadFileToString(command_line, &command_line_string)) {
- ParseArgsFromString(command_line_string, args);
- }
-}
-
-int ArgsToArgv(const std::vector<std::string>& args,
- std::vector<char*>* argv) {
- // We need to pass in a non-const char**.
- int argc = args.size();
-
- argv->resize(argc + 1);
- for (int i = 0; i < argc; ++i)
- (*argv)[i] = const_cast<char*>(args[i].c_str());
- (*argv)[argc] = NULL; // argv must be NULL terminated.
-
- return argc;
-}
-
-class ScopedMainEntryLogger {
- public:
- ScopedMainEntryLogger() {
- printf(">>ScopedMainEntryLogger\n");
- }
-
- ~ScopedMainEntryLogger() {
- printf("<<ScopedMainEntryLogger\n");
- fflush(stdout);
- fflush(stderr);
- }
-};
-
-} // namespace
-
-static void RunTests(JNIEnv* env,
- jobject obj,
- jstring jfiles_dir,
- jobject app_context) {
-
- // Command line basic initialization, will be fully initialized later.
- static const char* const kInitialArgv[] = { "ContentBrowserTestsActivity" };
- CommandLine::Init(arraysize(kInitialArgv), kInitialArgv);
-
- // Set the application context in base.
- base::android::ScopedJavaLocalRef<jobject> scoped_context(
- env, env->NewLocalRef(app_context));
- base::android::InitApplicationContext(scoped_context);
- base::android::RegisterJni(env);
-
- std::vector<std::string> args;
- ParseArgsFromCommandLineFile(&args);
-
- // We need to pass in a non-const char**.
- std::vector<char*> argv;
- int argc = ArgsToArgv(args, &argv);
-
- // Fully initialize command line with arguments.
- CommandLine::ForCurrentProcess()->AppendArguments(
- CommandLine(argc, &argv[0]), false);
-
- ScopedMainEntryLogger scoped_main_entry_logger;
- main(argc, &argv[0]);
-}
-
-// This is called by the VM when the shared library is first loaded.
-JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
- base::android::InitVM(vm);
- JNIEnv* env = base::android::AttachCurrentThread();
-
- if (!content::RegisterLibraryLoaderEntryHook(env))
- return -1;
-
- if (!content::android::RegisterShellJni(env))
- return -1;
-
- if (!RegisterNativesImpl(env))
- return -1;
-
- return JNI_VERSION_1_4;
-}
diff --git a/content/shell/android/browsertests_apk/res/layout/test_activity.xml b/content/shell/android/browsertests_apk/res/layout/test_activity.xml
deleted file mode 100644
index c62e66e..0000000
--- a/content/shell/android/browsertests_apk/res/layout/test_activity.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (c) 2012 The Chromium Authors. All rights reserved.
-
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
- -->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <org.chromium.content_shell.ShellManager
- android:id="@+id/shell_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</merge>
diff --git a/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java b/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java
deleted file mode 100644
index 6c7f09a..0000000
--- a/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content_browsertests_apk;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.util.Log;
-
-import org.chromium.content.app.LibraryLoader;
-import org.chromium.content.common.ProcessInitException;
-import org.chromium.ui.gfx.ActivityNativeWindow;
-import org.chromium.content_shell.ShellManager;
-
-public class ContentBrowserTestsActivity extends Activity {
- private static final String TAG = "ChromeBrowserTestsActivity";
-
- private ShellManager mShellManager;
- private ActivityNativeWindow mActivityNativeWindow;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- try {
- LibraryLoader.ensureInitialized();
- } catch (ProcessInitException e) {
- Log.i(TAG, "Cannot load content_browsertests:" + e);
- }
-
- setContentView(R.layout.test_activity);
- mShellManager = (ShellManager) findViewById(R.id.shell_container);
- mActivityNativeWindow = new ActivityNativeWindow(this);
- mShellManager.setWindow(mActivityNativeWindow);
-
- runTests();
- }
-
- private void runTests() {
- nativeRunTests(getFilesDir().getAbsolutePath(), getApplicationContext());
- }
-
- private native void nativeRunTests(String filesDir, Context appContext);
-}
diff --git a/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsApplication.java b/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsApplication.java
deleted file mode 100644
index 315a17e..0000000
--- a/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsApplication.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content_browsertests_apk;
-
-import android.app.Application;
-
-import org.chromium.base.PathUtils;
-import org.chromium.content.app.LibraryLoader;
-import org.chromium.content.browser.ResourceExtractor;
-
-public class ContentBrowserTestsApplication extends Application {
-
- private static final String NATIVE_LIBRARY = "content_browsertests";
- private static final String[] MANDATORY_PAK_FILES = new String[] {"content_shell.pak"};
- private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "content_shell";
-
- @Override
- public void onCreate() {
- super.onCreate();
- initializeApplicationParameters();
- }
-
- public static void initializeApplicationParameters() {
- ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAK_FILES);
- LibraryLoader.setLibraryToLoad(NATIVE_LIBRARY);
- PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
- }
-
-}
diff --git a/content/shell/android/shell_apk/AndroidManifest.xml b/content/shell/android/java/AndroidManifest.xml
index 77444a3..cfeb0c4 100644
--- a/content/shell/android/shell_apk/AndroidManifest.xml
+++ b/content/shell/android/java/AndroidManifest.xml
@@ -7,7 +7,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.chromium.content_shell_apk">
+ package="org.chromium.content_shell">
<permission android:name="org.chromium.content_shell.permission.SANDBOX"
android:protectionLevel="signature" />
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java b/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java
index 0ce99d8..cd3e546 100644
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.content_shell_apk;
+package org.chromium.content_shell;
import android.app.Activity;
import android.content.BroadcastReceiver;
@@ -23,8 +23,6 @@ import org.chromium.content.browser.DeviceUtils;
import org.chromium.content.browser.TracingIntentHandler;
import org.chromium.content.common.CommandLine;
import org.chromium.content.common.ProcessInitException;
-import org.chromium.content_shell.Shell;
-import org.chromium.content_shell.ShellManager;
import org.chromium.ui.gfx.ActivityNativeWindow;
/**
@@ -40,6 +38,7 @@ public class ContentShellActivity extends ChromiumActivity {
"org.chromium.content_shell.action.PROFILE_START";
private static final String ACTION_STOP_TRACE =
"org.chromium.content_shell.action.PROFILE_STOP";
+ public static final String DEFAULT_SHELL_URL = "http://www.google.com";
public static final String COMMAND_LINE_ARGS_KEY = "commandLineArgs";
private ShellManager mShellManager;
@@ -77,7 +76,7 @@ public class ContentShellActivity extends ChromiumActivity {
mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl));
}
if (!ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTOMATIC)) {
- String shellUrl = ShellManager.DEFAULT_SHELL_URL;
+ String shellUrl = DEFAULT_SHELL_URL;
if (savedInstanceState != null
&& savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) {
shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY);
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellApplication.java b/content/shell/android/java/src/org/chromium/content_shell/ContentShellApplication.java
index d070fb0..16f7c51 100644
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellApplication.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ContentShellApplication.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.content_shell_apk;
+package org.chromium.content_shell;
import android.app.Application;
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
index 7cf962d..4cc0906 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
@@ -21,12 +21,11 @@ import org.chromium.ui.gfx.NativeWindow;
@JNINamespace("content")
public class ShellManager extends FrameLayout {
- public static final String DEFAULT_SHELL_URL = "http://www.google.com";
private static boolean sStartup = true;
private NativeWindow mWindow;
private Shell mActiveShell;
- private String mStartupUrl = DEFAULT_SHELL_URL;
+ private String mStartupUrl = ContentShellActivity.DEFAULT_SHELL_URL;
// The target for all content rendering.
private ContentViewRenderView mContentViewRenderView;
@@ -72,7 +71,7 @@ public class ShellManager extends FrameLayout {
/**
* @return The currently visible shell view or null if one is not showing.
*/
- public Shell getActiveShell() {
+ protected Shell getActiveShell() {
return mActiveShell;
}
diff --git a/content/shell/android/javatests/AndroidManifest.xml b/content/shell/android/javatests/AndroidManifest.xml
index 3f27e60..fcd2465 100644
--- a/content/shell/android/javatests/AndroidManifest.xml
+++ b/content/shell/android/javatests/AndroidManifest.xml
@@ -5,7 +5,7 @@
<!-- package name must be unique so suffix with "tests" so package loader
doesn't ignore this. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.chromium.content_shell_apk.tests">
+ package="org.chromium.content_shell.tests">
<!-- We add an application tag here just so that we can indicate that this
package needs to link against the android.test library, which is
needed when building test cases. -->
@@ -14,8 +14,8 @@
</application>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
<instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="org.chromium.content_shell_apk"
- android:label="Tests for org.chromium.content_shell_apk"/>
+ android:targetPackage="org.chromium.content_shell"
+ android:label="Tests for org.chromium.content_shell"/>
<uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
<uses-permission android:name="android.permission.INJECT_EVENTS" />
</manifest>
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java b/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java
index f4d7a2f..23637df 100644
--- a/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java
+++ b/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java
@@ -18,7 +18,6 @@ import org.chromium.content.browser.test.util.CallbackHelper;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
-import org.chromium.content_shell_apk.ContentShellActivity;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellUrlTest.java b/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellUrlTest.java
index 98b06c1..05eba42 100644
--- a/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellUrlTest.java
+++ b/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellUrlTest.java
@@ -7,7 +7,6 @@ package org.chromium.content_shell;
import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.base.test.util.Feature;
-import org.chromium.content_shell_apk.ContentShellActivity;
/**
* Example test that just starts the content shell.
diff --git a/content/shell/android/java/res/drawable/progress.xml b/content/shell/android/res/drawable/progress.xml
index 93322b9..93322b9 100644
--- a/content/shell/android/java/res/drawable/progress.xml
+++ b/content/shell/android/res/drawable/progress.xml
diff --git a/content/shell/android/shell_apk/res/layout/content_shell_activity.xml b/content/shell/android/res/layout/content_shell_activity.xml
index c62e66e..c62e66e 100644
--- a/content/shell/android/shell_apk/res/layout/content_shell_activity.xml
+++ b/content/shell/android/res/layout/content_shell_activity.xml
diff --git a/content/shell/android/java/res/layout/shell_view.xml b/content/shell/android/res/layout/shell_view.xml
index d6c15d6..d6c15d6 100644
--- a/content/shell/android/java/res/layout/shell_view.xml
+++ b/content/shell/android/res/layout/shell_view.xml
diff --git a/content/shell/android/java/res/values/strings.xml b/content/shell/android/res/values/strings.xml
index 6eaaaec..6eaaaec 100644
--- a/content/shell/android/java/res/values/strings.xml
+++ b/content/shell/android/res/values/strings.xml
diff --git a/content/shell/android/shell_jni_registrar.cc b/content/shell/android/shell_jni_registrar.cc
deleted file mode 100644
index 504eda7..0000000
--- a/content/shell/android/shell_jni_registrar.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/shell/android/shell_jni_registrar.h"
-
-#include "base/android/jni_android.h"
-#include "base/android/jni_registrar.h"
-#include "content/shell/android/shell_manager.h"
-#include "content/shell/shell.h"
-
-namespace {
-
-static base::android::RegistrationMethod kShellRegistrationMethods[] = {
- { "Shell", content::Shell::Register },
- { "ShellManager", content::RegisterShellManager },
-};
-
-} // namespace
-
-namespace content {
-namespace android {
-
-bool RegisterShellJni(JNIEnv* env) {
- return RegisterNativeMethods(env, kShellRegistrationMethods,
- arraysize(kShellRegistrationMethods));
-}
-
-} // namespace android
-} // namespace content
diff --git a/content/shell/android/shell_jni_registrar.h b/content/shell/android/shell_jni_registrar.h
deleted file mode 100644
index f336c52..0000000
--- a/content/shell/android/shell_jni_registrar.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_SHELL_ANDROID_SHELL_JNI_REGISTRAR_H_
-#define CONTENT_SHELL_ANDROID_SHELL_JNI_REGISTRAR_H_
-
-#include <jni.h>
-
-namespace content {
-namespace android {
-
-// Register all JNI bindings necessary for content shell.
-bool RegisterShellJni(JNIEnv* env);
-
-} // namespace android
-} // namespace content
-
-#endif // CONTENT_SHELL_ANDROID_SHELL_JNI_REGISTRAR_H_
diff --git a/content/shell/android/shell_library_loader.cc b/content/shell/android/shell_library_loader.cc
index f320387f..88262c9 100644
--- a/content/shell/android/shell_library_loader.cc
+++ b/content/shell/android/shell_library_loader.cc
@@ -10,23 +10,31 @@
#include "content/public/app/android_library_loader_hooks.h"
#include "content/public/app/content_main.h"
#include "content/public/browser/android/compositor.h"
-#include "content/shell/android/shell_jni_registrar.h"
+#include "content/shell/android/shell_manager.h"
+#include "content/shell/shell.h"
#include "content/shell/shell_main_delegate.h"
+static base::android::RegistrationMethod kRegistrationMethods[] = {
+ { "Shell", content::Shell::Register },
+ { "ShellManager", content::RegisterShellManager },
+};
+
// This is called by the VM when the shared library is first loaded.
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
base::android::InitVM(vm);
JNIEnv* env = base::android::AttachCurrentThread();
-
if (!content::RegisterLibraryLoaderEntryHook(env))
return -1;
// To be called only from the UI thread. If loading the library is done on
// a separate thread, this should be moved elsewhere.
- if (!content::android::RegisterShellJni(env))
+ if (!base::android::RegisterNativeMethods(env, kRegistrationMethods,
+ arraysize(kRegistrationMethods)))
return -1;
content::Compositor::Initialize();
+
content::SetContentMainDelegate(new content::ShellMainDelegate());
+
return JNI_VERSION_1_4;
}
diff --git a/content/test/content_test_launcher.cc b/content/test/content_test_launcher.cc
index a34db6b..5eebd690 100644
--- a/content/test/content_test_launcher.cc
+++ b/content/test/content_test_launcher.cc
@@ -17,11 +17,6 @@
#include "content/shell/shell_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
-#if defined(OS_ANDROID)
-#include "base/message_loop.h"
-#include "base/message_pump_android.h"
-#endif
-
#if defined(OS_WIN)
#include "content/public/app/startup_helper_win.h"
#include "sandbox/win/src/sandbox_types.h"
@@ -57,12 +52,6 @@ class ContentShellTestSuiteInitializer
DISALLOW_COPY_AND_ASSIGN(ContentShellTestSuiteInitializer);
};
-#if defined(OS_ANDROID)
-base::MessagePump* CreateMessagePumpForUI() {
- return new base::MessagePumpForUI();
-};
-#endif
-
class ContentBrowserTestSuite : public ContentTestSuiteBase {
public:
ContentBrowserTestSuite(int argc, char** argv)
@@ -73,14 +62,6 @@ class ContentBrowserTestSuite : public ContentTestSuiteBase {
protected:
virtual void Initialize() OVERRIDE {
-
-#if defined(OS_ANDROID)
- // This needs to be done before base::TestSuite::Initialize() is called,
- // as it also tries to set MessagePumpForUIFactory.
- if (!MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUI))
- LOG(INFO) << "MessagePumpForUIFactory already set, unable to override.";
-#endif
-
ContentTestSuiteBase::Initialize();
testing::TestEventListeners& listeners =
diff --git a/content/test/run_all_unittests.cc b/content/test/run_all_unittests.cc
index 695cebe..58de889 100644
--- a/content/test/run_all_unittests.cc
+++ b/content/test/run_all_unittests.cc
@@ -5,7 +5,25 @@
#include "content/test/content_test_suite.h"
#include "content/public/test/unittest_test_suite.h"
+#if defined(OS_ANDROID)
+#include "base/android/jni_android.h"
+#include "content/browser/android/browser_jni_registrar.h"
+#include "content/common/android/common_jni_registrar.h"
+#include "net/android/net_jni_registrar.h"
+#include "ui/android/ui_jni_registrar.h"
+#endif
+
int main(int argc, char** argv) {
+
+#if defined(OS_ANDROID)
+ // Register JNI bindings for android.
+ JNIEnv* env = base::android::AttachCurrentThread();
+ content::android::RegisterCommonJni(env);
+ content::android::RegisterBrowserJni(env);
+ net::android::RegisterJni(env);
+ ui::android::RegisterJni(env);
+#endif
+
return content::UnitTestTestSuite(
new content::ContentTestSuite(argc, argv)).Run();
}