summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortkent <tkent@chromium.org>2015-08-18 20:18:23 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-19 03:19:12 +0000
commitec748bc5560f56d838178b07313e59bd4136f7ee (patch)
tree3fa2e150498fd8894a89e23d0e4357516cf313a7
parentab13676437fdc30f009274ff6108a60b4bcdd1e4 (diff)
downloadchromium_src-ec748bc5560f56d838178b07313e59bd4136f7ee.zip
chromium_src-ec748bc5560f56d838178b07313e59bd4136f7ee.tar.gz
chromium_src-ec748bc5560f56d838178b07313e59bd4136f7ee.tar.bz2
Revert of Convert ChromeSyncShell to use ChromePublic infrastructure (patchset #7 id:120001 of https://codereview.chromium.org/1282603005/ )
Reason for revert: broke ChromeSyncShell build. http://build.chromium.org/p/chromium.linux/builders/Android%20Arm64%20Builder%20%28dbg%29/builds/22336/steps/compile/logs/stdio Original issue's description: > Convert ChromeSyncShell to use ChromePublic infrastructure > > Several test fixes are included to support this change. > > Note: This CL only provides a GYP implementation (no GN). This is not a > regression from the previous state. > > BUG=510211 > > Committed: https://crrev.com/62ca3f0326203cca221bba6f0ee038ff292ecc66 > Cr-Commit-Position: refs/heads/master@{#344128} TBR=jbudorick@chromium.org,newt@chromium.org,pvalenzuela@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=510211 Review URL: https://codereview.chromium.org/1285373007 Cr-Commit-Position: refs/heads/master@{#344137}
-rw-r--r--build/all.gyp4
-rw-r--r--chrome/android/BUILD.gn69
-rw-r--r--chrome/android/chrome_apk.gyp182
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java1
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java2
-rw-r--r--chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc39
-rw-r--r--chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h25
-rw-r--r--chrome/android/sync_shell/java/AndroidManifest.xml.jinja2158
-rw-r--r--chrome/android/sync_shell/javatests/AndroidManifest.xml32
-rw-r--r--chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java3
-rw-r--r--chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java34
-rw-r--r--chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncCustomizationFragmentTest.java65
-rw-r--r--chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java8
-rw-r--r--chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java30
-rw-r--r--chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java2
-rw-r--r--chrome/browser/android/DEPS1
-rw-r--r--chrome/browser/android/chrome_sync_shell_main_delegate.cc24
-rw-r--r--chrome/browser/android/chrome_sync_shell_main_delegate.h25
-rw-r--r--chrome/browser/android/chrome_sync_shell_main_delegate_initializer.cc10
-rw-r--r--chrome/chrome_shell.gypi65
-rw-r--r--chrome/chrome_tests.gypi25
-rw-r--r--sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java4
-rw-r--r--sync/test/android/javatests/src/org/chromium/sync/test/util/MockSyncContentResolverDelegate.java3
23 files changed, 482 insertions, 329 deletions
diff --git a/build/all.gyp b/build/all.gyp
index 3adea2d..13f8b01 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -87,8 +87,8 @@
'../android_webview/android_webview.gyp:system_webview_apk',
'../android_webview/android_webview_shell.gyp:android_webview_shell_apk',
'../chrome/android/chrome_apk.gyp:chrome_public_apk',
- '../chrome/android/chrome_apk.gyp:chrome_sync_shell_apk',
'../chrome/chrome.gyp:chrome_shell_apk',
+ '../chrome/chrome.gyp:chrome_sync_shell_apk',
'../remoting/remoting.gyp:remoting_apk',
],
}],
@@ -875,9 +875,9 @@
'../android_webview/android_webview.gyp:android_webview_test_apk',
'../android_webview/android_webview.gyp:android_webview_unittests_apk',
'../chrome/android/chrome_apk.gyp:chrome_public_test_apk',
- '../chrome/android/chrome_apk.gyp:chrome_sync_shell_test_apk',
'../chrome/chrome.gyp:chrome_junit_tests',
'../chrome/chrome.gyp:chrome_shell_test_apk',
+ '../chrome/chrome.gyp:chrome_sync_shell_test_apk',
'../chrome/chrome.gyp:chrome_shell_uiautomator_tests',
'../chrome/chrome.gyp:chromedriver_webview_shell_apk',
'../chrome/chrome.gyp:unit_tests_apk',
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
index 6616e00..4cbd447 100644
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -251,6 +251,20 @@ shared_library("chrome_shell") {
]
}
+# GYP: //chrome/chrome_shell.gypi:libchromesyncshell
+shared_library("chrome_sync_shell") {
+ testonly = true
+ sources = [
+ #"shell/chrome_shell_entry_point.cc",
+ #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc",
+ #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h",
+ ]
+ deps = [
+ "//sync:test_support_sync_fake_server_android",
+ ]
+ data_deps = [ ":chrome_shell_base" ]
+}
+
# GYP: N/A
android_resources("chrome_shell_resources") {
deps = [
@@ -398,6 +412,33 @@ android_apk("chrome_shell_apk") {
#},
}
+chrome_sync_shell_manifest =
+ "$target_gen_dir/chrome_sync_shell_manifest/AndroidManifest.xml"
+
+# GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_manifest
+jinja_template("chrome_sync_shell_manifest") {
+ testonly = true
+ input = "sync_shell/java/AndroidManifest.xml.jinja2"
+ output = chrome_sync_shell_manifest
+}
+
+# GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_apk
+android_apk("chrome_sync_shell_apk") {
+ testonly = true
+ deps = [
+ ":chrome_shell_resources",
+ ":chrome_shell_java",
+ ":chrome_shell_assets",
+ ":chrome_sync_shell",
+ ":chrome_sync_shell_manifest",
+ "//base:base_java",
+ ]
+ apk_name = "ChromeSyncShell"
+ android_manifest = chrome_sync_shell_manifest
+ native_libs = [ "libchrome_sync_shell.so" ]
+ asset_location = chrome_shell_assets_dir
+}
+
# GYP: part of //chrome/chrome_tests.gypi:chrome_shell_test_apk
android_library("chrome_javatests") {
testonly = true
@@ -481,6 +522,34 @@ junit_binary("chrome_junit_tests") {
]
}
+# GYP: //chrome/chrome_tests.gypi:chrome_sync_shell_test_apk
+if (false) {
+ # TODO(GYP): We need sync/sync_tests.gypi:test_support_sync_proto_java to be ported.
+ # crbug.com/475612
+ instrumentation_test_apk("chrome_sync_shell_test_apk") {
+ apk_under_test = ":chrome_sync_shell_apk"
+ deps = [
+ ":chrome_java",
+ ":chrome_shell_java",
+ ":chrome_shell_test_java",
+ "//base:base_java",
+ "//base:base_java_test_support",
+ "//chrome/test/android:chrome_java_test_support",
+ "//components/invalidation/impl:java",
+ "//content/public/android:content_java",
+ "//content/public/test/android:content_java_test_support",
+ "//sync/android:sync_java",
+ "//sync:sync_java_test_support",
+ "//third_party/android_tools:android_support_v13_java",
+ "//third_party/android_tools:android_support_v7_appcompat_java",
+ "//ui/android:ui_java",
+ ]
+ apk_name = "ChromeSyncShellTest"
+ DEPRECATED_java_in_dir = "sync_shell/javatests/src"
+ android_manifest = "sync_shell/javatests/AndroidManifest.xml"
+ }
+}
+
# GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests_java
android_library("uiautomator_tests_java") {
testonly = true
diff --git a/chrome/android/chrome_apk.gyp b/chrome/android/chrome_apk.gyp
index b291bfc..6366013 100644
--- a/chrome/android/chrome_apk.gyp
+++ b/chrome/android/chrome_apk.gyp
@@ -10,11 +10,8 @@
'chromium_code': 1,
'package_name': 'chrome_public_apk',
'manifest_package': 'org.chromium.chrome',
- 'sync_shell_manifest_package': 'org.chromium.chrome.sync_shell',
'chrome_public_apk_manifest': '<(SHARED_INTERMEDIATE_DIR)/chrome_public_apk_manifest/AndroidManifest.xml',
'chrome_public_test_apk_manifest': '<(SHARED_INTERMEDIATE_DIR)/chrome_public_test_apk_manifest/AndroidManifest.xml',
- 'chrome_sync_shell_apk_manifest': '<(SHARED_INTERMEDIATE_DIR)/chrome_sync_shell_apk_manifest/AndroidManifest.xml',
- 'chrome_sync_shell_test_apk_manifest': '<(SHARED_INTERMEDIATE_DIR)/chrome_sync_shell_test_apk_manifest/AndroidManifest.xml',
# This list is shared with GN.
# Defines a list of source files should be present in the open-source
# chrome-apk but not in the published static_library which is included in the
@@ -63,46 +60,23 @@
'includes': [ '../../build/android/jinja_template.gypi' ],
},
{
- # TODO(pvalenzuela): Implement this target with GN:
- # http://crbug.com/475612
- 'target_name': 'chrome_sync_shell_template_resources',
- 'type': 'none',
- 'variables': {
- 'jinja_inputs_base_dir': 'java/res_template',
- 'jinja_inputs': [
- '<(jinja_inputs_base_dir)/xml/searchable.xml',
- '<(jinja_inputs_base_dir)/xml/syncadapter.xml',
- ],
- 'jinja_outputs_zip': '<(PRODUCT_DIR)/res.java/<(_target_name).zip',
- 'jinja_variables': [
- 'manifest_package=<(sync_shell_manifest_package)',
- ],
- },
- 'all_dependent_settings': {
- 'variables': {
- 'additional_input_paths': ['<(jinja_outputs_zip)'],
- 'dependencies_res_zip_paths': ['<(jinja_outputs_zip)'],
- },
- },
- 'includes': [ '../../build/android/jinja_template.gypi' ],
- },
- {
- # The base library used in both ChromePublic and ChromeSyncShell.
- 'target_name': 'libchrome_public_base',
- 'type': 'none',
+ # GN: //chrome/android:chrome_public
+ 'target_name': 'libchrome_public',
+ 'type': 'shared_library',
'dependencies': [
'../../chrome/chrome.gyp:chrome_android_core',
],
'include_dirs': [
'../..',
],
- 'direct_dependent_settings': {
- 'ldflags': [
- # Some android targets still depend on --gc-sections to link.
- # TODO: remove --gc-sections for Debug builds (crbug.com/159847).
- '-Wl,--gc-sections',
- ],
- },
+ 'sources': [
+ '<@(chrome_public_app_native_sources)',
+ ],
+ 'ldflags': [
+ # Some android targets still depend on --gc-sections to link.
+ # TODO: remove --gc-sections for Debug builds (crbug.com/159847).
+ '-Wl,--gc-sections',
+ ],
'conditions': [
# TODO(yfriedman): move this DEP to chrome_android_core to be shared
# between internal/external.
@@ -128,34 +102,6 @@
],
},
{
- # GN: //chrome/android:chrome_public
- 'target_name': 'libchrome_public',
- 'type': 'shared_library',
- 'sources': [
- '<@(chrome_public_app_native_sources)',
- ],
- 'dependencies': [
- 'libchrome_public_base',
- ],
- },
- {
- # TODO(pvalenzuela): Implement this target with GN:
- # http://crbug.com/475612
- 'target_name': 'libchrome_sync_shell',
- 'type': 'shared_library',
- 'sources': [
- '../browser/android/chrome_entry_point.cc',
- '../browser/android/chrome_sync_shell_main_delegate_initializer.cc',
- '../browser/android/chrome_sync_shell_main_delegate.h',
- '../browser/android/chrome_sync_shell_main_delegate.cc',
- ],
- 'dependencies': [
- 'libchrome_public_base',
- '../../sync/sync.gyp:sync',
- '../../sync/sync.gyp:test_support_sync_fake_server_android',
- ],
- },
- {
# GN: //chrome/android:chrome_public_apk_manifest
'target_name': 'chrome_public_manifest',
'type': 'none',
@@ -173,24 +119,6 @@
'includes': [ '../../build/android/jinja_template.gypi' ],
},
{
- # TODO(pvalenzuela): Implement this target with GN:
- # http://crbug.com/475612
- 'target_name': 'chrome_sync_shell_manifest',
- 'type': 'none',
- 'variables': {
- 'jinja_inputs': ['java/AndroidManifest.xml'],
- 'jinja_output': '<(chrome_sync_shell_apk_manifest)',
- 'jinja_variables': [
- 'channel=<(android_channel)',
- 'configuration_policy=<(configuration_policy)',
- 'manifest_package=<(sync_shell_manifest_package)',
- 'min_sdk_version=16',
- 'target_sdk_version=22',
- ],
- },
- 'includes': [ '../../build/android/jinja_template.gypi' ],
- },
- {
# GN: //chrome/android:chrome_public_apk
'target_name': 'chrome_public_apk',
'type': 'none',
@@ -228,48 +156,6 @@
'includes': [ '../../build/apk_fake_jar.gypi' ],
},
{
- # TODO(pvalenzuela): Implement this target with GN:
- # http://crbug.com/475612
- 'target_name': 'chrome_sync_shell_apk',
- 'type': 'none',
- 'variables': {
- 'android_manifest_path': '<(chrome_sync_shell_apk_manifest)',
- 'apk_name': 'ChromeSyncShell',
- 'native_lib_target': 'libchrome_sync_shell',
- 'java_in_dir': 'java',
- 'conditions': [
- # Only attempt loading the library from the APK for 64 bit devices
- # until the number of 32 bit devices which don't support this
- # approach falls to a minimal level - http://crbug.com/390618.
- ['component != "shared_library" and profiling==0 and (target_arch == "arm64" or target_arch == "x86_64")', {
- 'load_library_from_zip_file': '<(chrome_apk_load_library_from_zip)',
- 'load_library_from_zip': '<(chrome_apk_load_library_from_zip)',
- }],
- ],
- },
- 'dependencies': [
- 'chrome_android_paks_copy',
- 'chrome_sync_shell_template_resources',
- '../chrome.gyp:chrome_java',
- # This exists here because com.google.protobuf.nano is needed in tests,
- # but that code is stripped out via proguard. Adding this deps adds
- # usages and prevents removal of the proto code.
- '../../sync/sync.gyp:test_support_sync_proto_java',
- ],
- 'includes': [ 'chrome_apk.gypi' ],
- },
- {
- # GN: N/A
- # chrome_sync_shell_apk creates a .jar as a side effect. Any java targets
- # that need that .jar in their classpath should depend on this target.
- 'target_name': 'chrome_sync_shell_apk_java',
- 'type': 'none',
- 'dependencies': [
- 'chrome_sync_shell_apk',
- ],
- 'includes': [ '../../build/apk_fake_jar.gypi' ],
- },
- {
# GN: //chrome/android:chrome_shared_test_java
# This target is for sharing tests between both upstream and internal
# trees until sufficient test coverage is upstream.
@@ -291,6 +177,7 @@
'../../net/net.gyp:net_java',
'../../net/net.gyp:net_java_test_support',
'../../sync/sync.gyp:sync_java_test_support',
+ '../../sync/sync.gyp:sync_javatests',
'../../third_party/android_tools/android_tools.gyp:android_support_v7_appcompat_javalib',
'../../ui/android/ui_android.gyp:ui_javatests',
],
@@ -310,20 +197,6 @@
'includes': [ '../../build/android/jinja_template.gypi' ],
},
{
- # TODO(pvalenzuela): Implement this target with GN:
- # http://crbug.com/475612
- 'target_name': 'chrome_sync_shell_test_apk_manifest',
- 'type': 'none',
- 'variables': {
- 'jinja_inputs': ['sync_shell/javatests/AndroidManifest.xml'],
- 'jinja_output': '<(chrome_sync_shell_test_apk_manifest)',
- 'jinja_variables': [
- 'manifest_package=<(sync_shell_manifest_package)',
- ],
- },
- 'includes': [ '../../build/android/jinja_template.gypi' ],
- },
- {
# GN: //chrome/android:chrome_public_test_apk
'target_name': 'chrome_public_test_apk',
'type': 'none',
@@ -348,37 +221,6 @@
'../../build/android/test_runner.gypi',
],
},
- {
- # TODO(pvalenzuela): Implement this target with GN:
- # http://crbug.com/475612
- 'target_name': 'chrome_sync_shell_test_apk',
- 'type': 'none',
- 'dependencies': [
- 'chrome_sync_shell_apk_java',
- '../../base/base.gyp:base_java',
- '../../base/base.gyp:base_java_test_support',
- '../../chrome/chrome.gyp:chrome_java',
- '../../chrome/chrome.gyp:chrome_java_test_support',
- '../../sync/sync.gyp:sync_java',
- '../../sync/sync.gyp:sync_java_test_support',
- '../../sync/sync.gyp:sync_javatests',
- '../../sync/sync.gyp:test_support_sync_proto_java',
- '../../testing/android/on_device_instrumentation.gyp:broker_java',
- '../../testing/android/on_device_instrumentation.gyp:require_driver_apk',
- ],
- 'variables': {
- 'android_manifest_path': '<(chrome_sync_shell_test_apk_manifest)',
- 'package_name': 'chrome_sync_shell_test',
- 'java_in_dir': 'sync_shell/javatests',
- 'apk_name': 'ChromeSyncShellTest',
- 'is_test_apk': 1,
- 'test_type': 'instrumentation',
- },
- 'includes': [
- '../../build/java_apk.gypi',
- '../../build/android/test_runner.gypi',
- ],
- },
],
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
index 8fda10d..324dd7f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
@@ -504,7 +504,6 @@ public class ProfileSyncService {
* is assumed that the Java caller has ownership of this pointer;
* ownership is transferred as part of this call.
*/
- @VisibleForTesting
public void overrideNetworkResourcesForTest(long networkResources) {
nativeOverrideNetworkResourcesForTest(mNativeProfileSyncServiceAndroid, networkResources);
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java
index 300b848..9aa6b9d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java
@@ -15,7 +15,6 @@ import org.chromium.base.ApplicationState;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.ApplicationStatus.ApplicationStateListener;
import org.chromium.base.ThreadUtils;
-import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory;
import org.chromium.chrome.browser.invalidation.InvalidationController;
import org.chromium.chrome.browser.signin.AccountManagementFragment;
@@ -113,7 +112,6 @@ public class SyncController implements ApplicationStateListener,
* @param activity the current activity.
* @param accountName the full account name.
*/
- @VisibleForTesting
public void signIn(Activity activity, String accountName) {
final Account account = AccountManagerHelper.createAccountFromName(accountName);
diff --git a/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc b/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc
new file mode 100644
index 0000000..bcf45e5
--- /dev/null
+++ b/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc
@@ -0,0 +1,39 @@
+// Copyright 2014 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 "chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h"
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_registrar.h"
+#include "sync/test/fake_server/android/fake_server_helper_android.h"
+
+ChromeMainDelegateAndroid* ChromeMainDelegateAndroid::Create() {
+ return new ChromeMainDelegateChromeSyncShellAndroid();
+}
+
+ChromeMainDelegateChromeSyncShellAndroid::
+ChromeMainDelegateChromeSyncShellAndroid() {
+}
+
+ChromeMainDelegateChromeSyncShellAndroid::
+~ChromeMainDelegateChromeSyncShellAndroid() {
+}
+
+bool ChromeMainDelegateChromeSyncShellAndroid::BasicStartupComplete(
+ int* exit_code) {
+ return ChromeMainDelegateAndroid::BasicStartupComplete(exit_code);
+}
+
+int ChromeMainDelegateChromeSyncShellAndroid::RunProcess(
+ const std::string& process_type,
+ const content::MainFunctionParams& main_function_params) {
+ if (process_type.empty()) {
+ // This JNI registration can not be moved to JNI_OnLoad because
+ // FakeServerHelper seems not known by class loader when shared library
+ // is loaded.
+ FakeServerHelperAndroid::Register(base::android::AttachCurrentThread());
+ }
+ return ChromeMainDelegateAndroid::RunProcess(process_type,
+ main_function_params);
+}
diff --git a/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h b/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h
new file mode 100644
index 0000000..651a269
--- /dev/null
+++ b/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h
@@ -0,0 +1,25 @@
+// Copyright 2014 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 CHROME_ANDROID_SYNC_SHELL_CHROME_MAIN_DELEGATE_CHROME_SYNC_SHELL_ANDROID_H_
+#define CHROME_ANDROID_SYNC_SHELL_CHROME_MAIN_DELEGATE_CHROME_SYNC_SHELL_ANDROID_H_
+
+#include "chrome/app/android/chrome_main_delegate_android.h"
+
+class ChromeMainDelegateChromeSyncShellAndroid
+ : public ChromeMainDelegateAndroid {
+ public:
+ ChromeMainDelegateChromeSyncShellAndroid();
+ ~ChromeMainDelegateChromeSyncShellAndroid() override;
+
+ bool BasicStartupComplete(int* exit_code) override;
+ int RunProcess(
+ const std::string& process_type,
+ const content::MainFunctionParams& main_function_params) override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ChromeMainDelegateChromeSyncShellAndroid);
+};
+
+#endif // CHROME_ANDROID_SYNC_SHELL_CHROME_MAIN_DELEGATE_CHROME_SYNC_SHELL_ANDROID_H_
diff --git a/chrome/android/sync_shell/java/AndroidManifest.xml.jinja2 b/chrome/android/sync_shell/java/AndroidManifest.xml.jinja2
new file mode 100644
index 0000000..5d82703
--- /dev/null
+++ b/chrome/android/sync_shell/java/AndroidManifest.xml.jinja2
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- Copyright 2014 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.chrome.sync_shell">
+
+ <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
+ <uses-permission android:name="android.permission.NFC"/>
+ <uses-permission android:name="android.permission.RECORD_AUDIO"/>
+ <uses-permission android:name="android.permission.VIBRATE"/>
+ <uses-permission android:name="android.permission.WAKE_LOCK"/>
+ <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
+ <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
+ <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <!-- Only Chrome can receive the messages and registration result for GCM -->
+ <permission android:name="org.chromium.chrome.sync_shell.permission.C2D_MESSAGE"
+ android:protectionLevel="signature" />
+ <uses-permission android:name="org.chromium.chrome.sync_shell.permission.C2D_MESSAGE" />
+ <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
+
+ <application android:name="org.chromium.chrome.shell.ChromeShellApplication"
+ android:icon="@mipmap/app_icon"
+ android:label="Chrome Sync Shell">
+ <activity android:name="org.chromium.chrome.shell.ChromeShellActivity"
+ android:launchMode="singleTask"
+ android:theme="@style/MainTheme"
+ 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>
+ <activity android:name="org.chromium.sync.test.util.MockGrantCredentialsPermissionActivity"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </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. -->
+ {% set num_sandboxed_services = 20 %}
+ <meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
+ android:value="{{ num_sandboxed_services }}"/>
+ {% for i in range(num_sandboxed_services) %}
+ <service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}"
+ android:process=":sandboxed_process{{ i }}"
+ android:isolatedProcess="true"
+ android:exported="false" />
+ {% endfor %}
+
+ {% set num_privileged_services = 3 %}
+ <meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
+ android:value="{{ num_privileged_services }}"/>
+ {% for i in range(num_privileged_services) %}
+ <service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}"
+ android:process=":privileged_process{{ i }}"
+ android:isolatedProcess="false"
+ android:exported="false" />
+ {% endfor %}
+
+ <!-- Receiver for GCM messages. Rebroadcasts them locally for sync. -->
+ <receiver android:exported="true"
+ android:name="com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener$GCMReceiver"
+ android:permission="com.google.android.c2dm.permission.SEND">
+ <intent-filter>
+ <action android:name="com.google.android.c2dm.intent.RECEIVE" />
+ <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
+ <category android:name="org.chromium.chrome.shell"/>
+ </intent-filter>
+ </receiver>
+ <service android:exported="false"
+ android:name="com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener">
+ <meta-data android:name="sender_ids"
+ android:value="cloudprint.c2dm@gmail.com,ipc.invalidation@gmail.com"/>
+ </service>
+
+ <!-- Notification service for sync. -->
+ <meta-data android:name="ipc.invalidation.ticl.listener_service_class"
+ android:value="org.chromium.components.invalidation.InvalidationClientService"/>
+ <service android:name="org.chromium.components.invalidation.InvalidationClientService"
+ android:exported="false">
+ <intent-filter>
+ <action android:name="com.google.ipc.invalidation.AUTH_TOKEN_REQUEST"/>
+ </intent-filter>
+ </service>
+ <service android:exported="false"
+ android:name="com.google.ipc.invalidation.ticl.android2.TiclService"/>
+ <service android:exported="false"
+ android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageSenderService"/>
+ <receiver android:exported="false"
+ android:name="com.google.ipc.invalidation.ticl.android2.AndroidInternalScheduler$AlarmReceiver"/>
+ <receiver android:exported="false"
+ android:name="com.google.ipc.invalidation.external.client.contrib.AndroidListener$AlarmReceiver"/>
+
+ <!-- Notification service multiplexed GCM receiver -->
+ <service android:exported="false"
+ android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageReceiverService"
+ android:enabled="true"/>
+ <receiver android:exported="false"
+ android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageReceiverService$Receiver">
+ <intent-filter>
+ <action android:name="com.google.ipc.invalidation.gcmmplex.EVENT" />
+ </intent-filter>
+ </receiver>
+
+ <!-- GCMDriver multiplexed GCM receiver -->
+ <service android:exported="false"
+ android:name="org.chromium.chrome.browser.services.gcm.GCMListener"/>
+ <receiver android:exported="false"
+ android:name="org.chromium.chrome.browser.services.gcm.GCMListener$Receiver">
+ <intent-filter>
+ <action android:name="com.google.ipc.invalidation.gcmmplex.EVENT" />
+ </intent-filter>
+ </receiver>
+
+ <provider android:name="org.chromium.chrome.browser.ChromeBrowserProvider"
+ android:authorities="org.chromium.chrome.sync_shell"
+ android:exported="true" />
+
+ <!-- Sync adapter for browser invalidation. -->
+ <service android:exported="false"
+ android:name="org.chromium.chrome.shell.invalidation.ChromeShellSyncAdapterService">
+ <intent-filter>
+ <action android:name="android.content.SyncAdapter" />
+ </intent-filter>
+ <meta-data android:name="android.content.SyncAdapter"
+ android:resource="@xml/syncadapter" />
+ </service>
+
+ <!-- Broadcast receiver that will be notified of account changes. -->
+ <receiver android:name="org.chromium.chrome.shell.signin.AccountsChangedReceiver">
+ <intent-filter>
+ <action android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED" />
+ </intent-filter>
+ </receiver>
+ <meta-data android:name="org.chromium.content.browser.SMART_CLIP_PROVIDER"
+ android:value="org.chromium.content.browser.SmartClipProvider" />
+
+ </application>
+</manifest>
diff --git a/chrome/android/sync_shell/javatests/AndroidManifest.xml b/chrome/android/sync_shell/javatests/AndroidManifest.xml
index eb83976..2b063ec 100644
--- a/chrome/android/sync_shell/javatests/AndroidManifest.xml
+++ b/chrome/android/sync_shell/javatests/AndroidManifest.xml
@@ -1,25 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2015 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 name must be unique. -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.chromium.chrome.sync_shell.tests">
+ <!-- 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 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.chrome.sync_shell.tests">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
+ <uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.READ_LOGS"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
- <uses-permission android:name="android.permission.INTERNET" />
-
- <application
- android:label="ChromeSyncShellTest">
-
+ <!-- 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. -->
+ <application>
<uses-library android:name="android.test.runner" />
-
<activity android:name="org.chromium.sync.test.util.MockGrantCredentialsPermissionActivity"
- android:exported="true">
+ android:exported="false">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
@@ -27,6 +25,6 @@
</activity>
</application>
<instrumentation android:name="org.chromium.chrome.test.ChromeInstrumentationTestRunner"
- android:targetPackage="{{manifest_package}}"
- android:label="Tests for {{manifest_package}}"/>
+ android:targetPackage="org.chromium.chrome.sync_shell"
+ android:label="Tests for org.chromium.chrome.sync_shell"/>
</manifest>
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java
index e228ddf..9b2cc38 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java
@@ -9,9 +9,7 @@ import android.os.Bundle;
import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.base.ThreadUtils;
-import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
-import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.firstrun.FirstRunActivity;
import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor;
import org.chromium.chrome.test.util.browser.sync.SyncTestUtil;
@@ -20,7 +18,6 @@ import org.chromium.sync.AndroidSyncSettings;
/**
* Tests for the first run experience.
*/
-@CommandLineFlags.Remove(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)
public class FirstRunTest extends SyncTestBase {
private static final String TAG = "FirstRunTest";
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java
index e164db3..9951b85 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java
@@ -9,7 +9,6 @@ import android.util.Pair;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.Feature;
-import org.chromium.chrome.browser.tabmodel.TabModelUtils;
import org.chromium.chrome.test.util.browser.sync.SyncTestUtil;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
@@ -90,8 +89,8 @@ public class OpenTabsTest extends SyncTestBase {
@Feature({"Sync"})
public void testUploadMultipleOpenTabs() throws Exception {
loadUrl(URL);
- loadUrlInNewTab(URL2);
- loadUrlInNewTab(URL3);
+ openNewTab(URL2);
+ openNewTab(URL3);
waitForLocalTabsForClient(mClientName, URL, URL2, URL3);
waitForServerTabs(URL, URL2, URL3);
}
@@ -102,17 +101,10 @@ public class OpenTabsTest extends SyncTestBase {
public void testUploadAndCloseOpenTab() throws Exception {
loadUrl(URL);
// Can't have zero tabs, so we have to open two to test closing one.
- loadUrlInNewTab(URL2);
+ openNewTab(URL2);
waitForLocalTabsForClient(mClientName, URL, URL2);
waitForServerTabs(URL, URL2);
-
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {
- assertTrue(TabModelUtils.closeCurrentTab(getActivity().getCurrentTabModel()));
- }
- });
-
+ closeActiveTab();
waitForLocalTabsForClient(mClientName, URL);
waitForServerTabs(URL);
}
@@ -177,6 +169,24 @@ public class OpenTabsTest extends SyncTestBase {
waitForLocalTabsForClient(FAKE_CLIENT);
}
+ private void openNewTab(final String url) {
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ getActivity().createTab(url);
+ }
+ });
+ }
+
+ private void closeActiveTab() {
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ getActivity().closeTab();
+ }
+ });
+ }
+
private String makeSessionTag() {
return SESSION_TAG_PREFIX + (mSessionTagCounter++);
}
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncCustomizationFragmentTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncCustomizationFragmentTest.java
index 3335ed5..11b7b53 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncCustomizationFragmentTest.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncCustomizationFragmentTest.java
@@ -5,30 +5,30 @@
package org.chromium.chrome.browser.sync;
import android.annotation.SuppressLint;
+import android.app.Activity;
import android.app.Dialog;
import android.app.FragmentTransaction;
import android.content.Context;
+import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.SwitchPreference;
import android.preference.TwoStatePreference;
import android.support.v7.app.AlertDialog;
import android.test.suitebuilder.annotation.SmallTest;
+import android.view.View;
import android.widget.Button;
-import android.widget.CheckedTextView;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.Feature;
-import org.chromium.chrome.R;
-import org.chromium.chrome.browser.preferences.Preferences;
import org.chromium.chrome.browser.sync.ui.PassphraseCreationDialogFragment;
import org.chromium.chrome.browser.sync.ui.PassphraseDialogFragment;
import org.chromium.chrome.browser.sync.ui.PassphraseTypeDialogFragment;
import org.chromium.chrome.browser.sync.ui.SyncCustomizationFragment;
-import org.chromium.chrome.test.util.ActivityUtils;
+import org.chromium.chrome.shell.R;
import org.chromium.chrome.test.util.browser.sync.SyncTestUtil;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
@@ -88,12 +88,12 @@ public class SyncCustomizationFragmentTest extends SyncTestBase {
SyncCustomizationFragment.PREFERENCE_SYNC_SETTINGS);
}
- private Preferences mPreferences;
+ private Activity mActivity;
@Override
protected void setUp() throws Exception {
super.setUp();
- mPreferences = null;
+ mActivity = getActivity();
}
@SmallTest
@@ -236,7 +236,7 @@ public class SyncCustomizationFragmentTest extends SyncTestBase {
public void testDefaultEncryptionOptions() throws Exception {
setupTestAccountAndSignInToSync(CLIENT_ID);
SyncTestUtil.waitForSyncActive(mContext);
- final SyncCustomizationFragment fragment = startSyncCustomizationFragment();
+ SyncCustomizationFragment fragment = startSyncCustomizationFragment();
Preference encryption = getEncryption(fragment);
clickPreference(encryption);
@@ -250,14 +250,12 @@ public class SyncCustomizationFragmentTest extends SyncTestBase {
assertEquals(PassphraseType.CUSTOM_PASSPHRASE, adapter.getType(0));
assertEquals(PassphraseType.KEYSTORE_PASSPHRASE, adapter.getType(1));
assertEquals(2, listView.getCount());
-
- // Make sure they are both enabled and the correct one is selected.
- CheckedTextView customView = (CheckedTextView) listView.getChildAt(0);
- CheckedTextView keystoreView = (CheckedTextView) listView.getChildAt(1);
- assertTrue("The custom passphrase view should be enabled.", customView.isEnabled());
- assertFalse("The custom passphrase option should be checked.", customView.isChecked());
- assertTrue("The keystore passphrase view should be enabled.", keystoreView.isEnabled());
- assertTrue("The keystore passphrase option should be checked.", keystoreView.isChecked());
+ // Make sure they are both enabled and the correct on is selected.
+ View customView = listView.getChildAt(0);
+ View keystoreView = listView.getChildAt(1);
+ assertTrue(customView.isEnabled());
+ assertTrue(keystoreView.isEnabled());
+ assertEquals(keystoreView, listView.getSelectedView());
}
/**
@@ -334,9 +332,8 @@ public class SyncCustomizationFragmentTest extends SyncTestBase {
public void run() {
pss.syncStateChanged();
fragment.getFragmentManager().executePendingTransactions();
- assertNull("PassphraseDialogFragment should be dismissed.",
- mPreferences.getFragmentManager().findFragmentByTag(
- SyncCustomizationFragment.FRAGMENT_ENTER_PASSPHRASE));
+ PassphraseDialogFragment passphraseFragment = getPassphraseDialogFragment();
+ assertNull(passphraseFragment);
}
});
}
@@ -412,13 +409,20 @@ public class SyncCustomizationFragmentTest extends SyncTestBase {
}
private SyncCustomizationFragment startSyncCustomizationFragment() {
- mPreferences = startPreferences(SyncCustomizationFragment.class.getName());
+ SyncCustomizationFragment fragment = new SyncCustomizationFragment();
+ Bundle args = new Bundle();
+ args.putString(SyncCustomizationFragment.ARGUMENT_ACCOUNT,
+ SyncTestUtil.DEFAULT_TEST_ACCOUNT);
+ fragment.setArguments(args);
+ FragmentTransaction transaction = mActivity.getFragmentManager().beginTransaction();
+ transaction.add(R.id.content_container, fragment, TAG);
+ transaction.commit();
getInstrumentation().waitForIdleSync();
- return (SyncCustomizationFragment) mPreferences.getFragmentForTest();
+ return fragment;
}
private void closeFragment(SyncCustomizationFragment fragment) {
- FragmentTransaction transaction = mPreferences.getFragmentManager().beginTransaction();
+ FragmentTransaction transaction = mActivity.getFragmentManager().beginTransaction();
transaction.remove(fragment);
transaction.commit();
getInstrumentation().waitForIdleSync();
@@ -455,22 +459,19 @@ public class SyncCustomizationFragmentTest extends SyncTestBase {
SyncCustomizationFragment.PREFERENCE_SYNC_MANAGE_DATA);
}
- private PassphraseDialogFragment getPassphraseDialogFragment()
- throws InterruptedException {
- return ActivityUtils.<PassphraseDialogFragment>waitForFragment(mPreferences,
+ private PassphraseDialogFragment getPassphraseDialogFragment() {
+ return (PassphraseDialogFragment) mActivity.getFragmentManager().findFragmentByTag(
SyncCustomizationFragment.FRAGMENT_ENTER_PASSPHRASE);
}
- private PassphraseTypeDialogFragment getPassphraseTypeDialogFragment()
- throws InterruptedException {
- return ActivityUtils.<PassphraseTypeDialogFragment>waitForFragment(mPreferences,
- SyncCustomizationFragment.FRAGMENT_PASSPHRASE_TYPE);
+ private PassphraseTypeDialogFragment getPassphraseTypeDialogFragment() {
+ return (PassphraseTypeDialogFragment) mActivity.getFragmentManager()
+ .findFragmentByTag(SyncCustomizationFragment.FRAGMENT_PASSPHRASE_TYPE);
}
- private PassphraseCreationDialogFragment getPassphraseCreationDialogFragment()
- throws InterruptedException {
- return ActivityUtils.<PassphraseCreationDialogFragment>waitForFragment(mPreferences,
- SyncCustomizationFragment.FRAGMENT_CUSTOM_PASSPHRASE);
+ private PassphraseCreationDialogFragment getPassphraseCreationDialogFragment() {
+ return (PassphraseCreationDialogFragment) mActivity.getFragmentManager()
+ .findFragmentByTag(SyncCustomizationFragment.FRAGMENT_CUSTOM_PASSPHRASE);
}
private void assertDefaultSyncOnState(SyncCustomizationFragment fragment) {
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
index 1b1c64c..fcf500f 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
@@ -12,7 +12,7 @@ import android.util.Log;
import org.chromium.base.ActivityState;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.test.util.Feature;
-import org.chromium.chrome.browser.ChromeActivity;
+import org.chromium.chrome.shell.ChromeShellActivity;
import org.chromium.chrome.test.util.browser.sync.SyncTestUtil;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.test.util.Criteria;
@@ -80,7 +80,7 @@ public class SyncTest extends SyncTestBase {
public void testAboutSyncPageDisplaysCurrentSyncStatus() throws InterruptedException {
setupTestAccountAndSignInToSync(CLIENT_ID);
- loadUrl("chrome://sync");
+ loadUrlWithSanitization("chrome://sync");
SyncTestUtil.AboutSyncInfoGetter aboutInfoGetter =
new SyncTestUtil.AboutSyncInfoGetter(getActivity());
try {
@@ -169,7 +169,7 @@ public class SyncTest extends SyncTestBase {
SyncTestUtil.verifySyncIsActiveForAccount(mContext, account);
}
- private static ContentViewCore getContentViewCore(ChromeActivity activity) {
- return activity.getActivityTab().getContentViewCore();
+ private static ContentViewCore getContentViewCore(ChromeShellActivity activity) {
+ return activity.getActiveContentViewCore();
}
}
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
index e5e3987..24b7bc5 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
@@ -8,13 +8,12 @@ import android.accounts.Account;
import android.content.Context;
import org.chromium.base.ThreadUtils;
-import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.identity.UniqueIdentificationGenerator;
import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory;
import org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator;
import org.chromium.chrome.browser.signin.AccountIdProvider;
import org.chromium.chrome.browser.signin.SigninManager;
-import org.chromium.chrome.test.ChromeActivityTestCaseBase;
+import org.chromium.chrome.shell.ChromeShellTestBase;
import org.chromium.chrome.test.util.browser.sync.SyncTestUtil;
import org.chromium.sync.AndroidSyncSettings;
import org.chromium.sync.signin.AccountManagerHelper;
@@ -27,7 +26,7 @@ import java.util.Set;
/**
* Base class for common functionality between sync tests.
*/
-public class SyncTestBase extends ChromeActivityTestCaseBase<ChromeActivity> {
+public class SyncTestBase extends ChromeShellTestBase {
private static final String TAG = "SyncTestBase";
protected static final String CLIENT_ID = "Client_ID";
@@ -39,33 +38,21 @@ public class SyncTestBase extends ChromeActivityTestCaseBase<ChromeActivity> {
protected ProfileSyncService mProfileSyncService;
protected MockSyncContentResolverDelegate mSyncContentResolver;
- public SyncTestBase() {
- super(ChromeActivity.class);
- }
-
- @Override
- public void startMainActivity() throws InterruptedException {
- // Start the activity by opening about:blank. This URL is ideal because it is not synced as
- // a typed URL. If another URL is used, it could interfere with test data.
- startMainActivityOnBlankPage();
- }
-
@Override
protected void setUp() throws Exception {
- // This must be called before super.setUp() in order for test authentication to work
- // properly.
- mapAccountNamesToIds();
-
super.setUp();
+ assertTrue("Clearing app data failed.", clearAppData());
Context targetContext = getInstrumentation().getTargetContext();
mContext = new SyncTestUtil.SyncTestContext(targetContext);
+ mapAccountNamesToIds();
setUpMockAndroidSyncSettings();
setUpMockAccountManager();
// Initializes ChromeSigninController to use our test context.
ChromeSigninController.get(mContext);
+ startChromeBrowserProcessSync(targetContext);
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
@@ -82,6 +69,13 @@ public class SyncTestBase extends ChromeActivityTestCaseBase<ChromeActivity> {
mProfileSyncService = ProfileSyncService.get(mContext);
}
});
+
+ // Start the activity by opening about:blank. This URL is ideal because it is not synced as
+ // a typed URL. If another URL is used, it could interfere with test data. This call is in
+ // this location so that it takes place before any other calls to getActivity(). If
+ // getActivity() is called without any prior configuration, an undesired URL
+ // (e.g., google.com) will be opened.
+ launchChromeShellWithBlankPage();
}
@Override
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java
index 248d7b0..abad5bb 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java
@@ -104,7 +104,7 @@ public class TypedUrlsTest extends SyncTestBase {
@Override
public void run() {
LoadUrlParams params = new LoadUrlParams(url, PageTransition.TYPED);
- getActivity().getActivityTab().loadUrl(params);
+ getActivity().getActiveTab().loadUrl(params);
}
});
}
diff --git a/chrome/browser/android/DEPS b/chrome/browser/android/DEPS
index 5894717..4dc31ea 100644
--- a/chrome/browser/android/DEPS
+++ b/chrome/browser/android/DEPS
@@ -8,5 +8,4 @@ include_rules = [
"+cc/layers/layer.h",
"+sandbox/linux/seccomp-bpf/sandbox_bpf.h",
"+sync/android",
- "+sync/test/fake_server/android",
]
diff --git a/chrome/browser/android/chrome_sync_shell_main_delegate.cc b/chrome/browser/android/chrome_sync_shell_main_delegate.cc
deleted file mode 100644
index b5bc9ed..0000000
--- a/chrome/browser/android/chrome_sync_shell_main_delegate.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2015 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 "chrome/browser/android/chrome_sync_shell_main_delegate.h"
-
-#include "base/android/jni_android.h"
-#include "sync/test/fake_server/android/fake_server_helper_android.h"
-
-ChromeSyncShellMainDelegate::ChromeSyncShellMainDelegate() {
-}
-
-ChromeSyncShellMainDelegate::~ChromeSyncShellMainDelegate() {
-}
-
-int ChromeSyncShellMainDelegate::RunProcess(
- const std::string& process_type,
- const content::MainFunctionParams& main_function_params) {
- if (process_type.empty()) {
- FakeServerHelperAndroid::Register(base::android::AttachCurrentThread());
- }
- return ChromeMainDelegateStagingAndroid::RunProcess(
- process_type, main_function_params);
-}
diff --git a/chrome/browser/android/chrome_sync_shell_main_delegate.h b/chrome/browser/android/chrome_sync_shell_main_delegate.h
deleted file mode 100644
index c4d2d88..0000000
--- a/chrome/browser/android/chrome_sync_shell_main_delegate.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 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 CHROME_BROWSER_ANDROID_CHROME_SYNC_SHELL_MAIN_DELEGATE_H_
-#define CHROME_BROWSER_ANDROID_CHROME_SYNC_SHELL_MAIN_DELEGATE_H_
-
-#include "chrome/browser/android/chrome_main_delegate_staging_android.h"
-
-class ChromeSyncShellMainDelegate
- : public ChromeMainDelegateStagingAndroid {
- public:
- ChromeSyncShellMainDelegate();
- ~ChromeSyncShellMainDelegate() override;
-
- protected:
- int RunProcess(
- const std::string& process_type,
- const content::MainFunctionParams& main_function_params) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ChromeSyncShellMainDelegate);
-};
-
-#endif // CHROME_BROWSER_ANDROID_CHROME_SYNC_SHELL_MAIN_DELEGATE_H_
diff --git a/chrome/browser/android/chrome_sync_shell_main_delegate_initializer.cc b/chrome/browser/android/chrome_sync_shell_main_delegate_initializer.cc
deleted file mode 100644
index b7c0da6..0000000
--- a/chrome/browser/android/chrome_sync_shell_main_delegate_initializer.cc
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2015 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 "chrome/app/android/chrome_main_delegate_android.h"
-#include "chrome/browser/android/chrome_sync_shell_main_delegate.h"
-
-ChromeMainDelegateAndroid* ChromeMainDelegateAndroid::Create() {
- return new ChromeSyncShellMainDelegate();
-}
diff --git a/chrome/chrome_shell.gypi b/chrome/chrome_shell.gypi
index b48a169..7e2e8f5 100644
--- a/chrome/chrome_shell.gypi
+++ b/chrome/chrome_shell.gypi
@@ -57,6 +57,21 @@
],
},
{
+ # GN: //chrome/android:chrome_sync_shell
+ 'target_name': 'libchromesyncshell',
+ 'type': 'shared_library',
+ 'sources': [
+ 'android/shell/chrome_shell_entry_point.cc',
+ 'android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc',
+ 'android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h',
+ ],
+ 'dependencies': [
+ 'libchromeshell_base',
+ '../sync/sync.gyp:sync_core',
+ '../sync/sync.gyp:test_support_sync_fake_server_android',
+ ],
+ },
+ {
# GN: //chrome/android:chrome_shell_manifest
'target_name': 'chrome_shell_manifest',
'type': 'none',
@@ -107,6 +122,56 @@
],
'includes': [ '../build/apk_fake_jar.gypi' ],
},
+ {
+ # GN: //chrome/android:chrome_sync_shell_manifest
+ 'target_name': 'chrome_sync_shell_manifest',
+ 'type': 'none',
+ 'variables': {
+ 'jinja_inputs': ['android/sync_shell/java/AndroidManifest.xml.jinja2'],
+ 'jinja_output': '<(SHARED_INTERMEDIATE_DIR)/chrome_sync_shell_manifest/AndroidManifest.xml',
+ },
+ 'includes': [ '../build/android/jinja_template.gypi' ],
+ },
+ {
+ # GN: //chrome/android:chrome_sync_shell_apk
+ 'target_name': 'chrome_sync_shell_apk',
+ 'type': 'none',
+ 'dependencies': [
+ 'chrome_java',
+ 'chrome_android_paks_copy',
+ 'libchromesyncshell',
+ '../media/media.gyp:media_java',
+ '../sync/sync.gyp:sync_java_test_support',
+ ],
+ 'variables': {
+ 'apk_name': 'ChromeSyncShell',
+ 'android_manifest_path': '<(SHARED_INTERMEDIATE_DIR)/chrome_sync_shell_manifest/AndroidManifest.xml',
+ 'R_package': 'org.chromium.chrome.shell',
+ 'native_lib_version_name': '<(version_full)',
+ 'java_in_dir': 'android/shell/java',
+ 'resource_dir': 'android/shell/res',
+ 'asset_location': '<(PRODUCT_DIR)/assets/<(package_name)',
+ 'native_lib_target': 'libchromesyncshell',
+ 'additional_input_paths': [
+ '<@(chrome_android_pak_output_resources)',
+ ],
+ },
+ 'includes': [ '../build/java_apk.gypi', ],
+ },
+ {
+ # GN: N/A
+ # chrome_sync_shell_apk creates a .jar as a side effect. Any java
+ # targets that need that .jar in their classpath should depend on this
+ # target. Dependents of chrome_sync_shell_apk receive its jar path in the
+ # variable 'apk_output_jar_path'. This target should only be used by
+ # targets which instrument chrome_sync_shell_apk.
+ 'target_name': 'chrome_sync_shell_apk_java',
+ 'type': 'none',
+ 'dependencies': [
+ 'chrome_sync_shell_apk',
+ ],
+ 'includes': [ '../build/apk_fake_jar.gypi' ],
+ },
],
}
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 6ab44cb..4f83083 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -3092,6 +3092,31 @@
'includes': [ '../build/uiautomator_test.gypi' ],
},
{
+ # GN: //chrome/android:chrome_sync_shell_test_apk
+ 'target_name': 'chrome_sync_shell_test_apk',
+ 'type': 'none',
+ 'dependencies': [
+ 'chrome_java',
+ 'chrome_sync_shell_apk_java',
+ 'chrome_java_test_support',
+ '../base/base.gyp:base',
+ '../base/base.gyp:base_java_test_support',
+ '../content/content_shell_and_tests.gyp:content_java_test_support',
+ '../sync/sync.gyp:test_support_sync_proto_java',
+ ],
+ 'variables': {
+ 'apk_name': 'ChromeSyncShellTest',
+ 'java_in_dir': 'android/sync_shell/javatests',
+ 'additional_src_dirs': [ 'android/shell/javatests', ],
+ 'is_test_apk': 1,
+ 'test_type': 'instrumentation',
+ },
+ 'includes': [
+ '../build/java_apk.gypi',
+ '../build/android/test_runner.gypi',
+ ],
+ },
+ {
# GN: //chrome/test/android:chrome_java_test_support
'target_name': 'chrome_java_test_support',
'type': 'none',
diff --git a/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java b/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java
index 532abe1..a9f8239 100644
--- a/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java
+++ b/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java
@@ -27,7 +27,6 @@ import android.os.Handler;
import android.text.TextUtils;
import org.chromium.base.Log;
-import org.chromium.base.VisibleForTesting;
import org.chromium.sync.signin.AccountManagerDelegate;
import org.chromium.sync.signin.AccountManagerHelper;
@@ -89,7 +88,6 @@ public class MockAccountManager implements AccountManagerDelegate {
private final SingleThreadedExecutor mExecutor;
- @VisibleForTesting
public MockAccountManager(Context context, Context testContext, Account... accounts) {
mContext = context;
// The manifest that is backing testContext needs to provide the
@@ -136,7 +134,6 @@ public class MockAccountManager implements AccountManagerDelegate {
}
}
- @VisibleForTesting
public boolean addAccountHolderExplicitly(AccountHolder accountHolder) {
return addAccountHolderExplicitly(accountHolder, false);
}
@@ -157,7 +154,6 @@ public class MockAccountManager implements AccountManagerDelegate {
return result;
}
- @VisibleForTesting
public boolean removeAccountHolderExplicitly(AccountHolder accountHolder) {
return removeAccountHolderExplicitly(accountHolder, false);
}
diff --git a/sync/test/android/javatests/src/org/chromium/sync/test/util/MockSyncContentResolverDelegate.java b/sync/test/android/javatests/src/org/chromium/sync/test/util/MockSyncContentResolverDelegate.java
index 26b9db5..b467d26 100644
--- a/sync/test/android/javatests/src/org/chromium/sync/test/util/MockSyncContentResolverDelegate.java
+++ b/sync/test/android/javatests/src/org/chromium/sync/test/util/MockSyncContentResolverDelegate.java
@@ -14,7 +14,6 @@ import android.os.Bundle;
import junit.framework.Assert;
import org.chromium.base.ThreadUtils;
-import org.chromium.base.VisibleForTesting;
import org.chromium.sync.SyncContentResolverDelegate;
import java.util.HashMap;
@@ -71,7 +70,6 @@ public class MockSyncContentResolverDelegate implements SyncContentResolverDeleg
}
@Override
- @VisibleForTesting
public void setMasterSyncAutomatically(boolean sync) {
if (mMasterSyncAutomatically == sync) return;
@@ -172,7 +170,6 @@ public class MockSyncContentResolverDelegate implements SyncContentResolverDeleg
*
* @throws InterruptedException
*/
- @VisibleForTesting
public void waitForLastNotificationCompleted() throws InterruptedException {
Assert.assertTrue("Timed out waiting for notifications to complete.",
mPendingObserverCount.tryAcquire(5, TimeUnit.SECONDS));