diff options
author | serya <serya@chromium.org> | 2014-12-15 01:33:26 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-15 09:33:52 +0000 |
commit | e4584d5cb7327be5e2d76752855757a9e0c2785e (patch) | |
tree | bca0eeb6bec620a8220af7fd22972fd2b831edd5 | |
parent | 2e1a8a3653f0a64de91e6d6673c54d37f9818fbe (diff) | |
download | chromium_src-e4584d5cb7327be5e2d76752855757a9e0c2785e.zip chromium_src-e4584d5cb7327be5e2d76752855757a9e0c2785e.tar.gz chromium_src-e4584d5cb7327be5e2d76752855757a9e0c2785e.tar.bz2 |
Revert of Stub for web-base client for DevTools bridge and tests (patchset #5 id:100001 of https://codereview.chromium.org/736363002/)
Reason for revert:
Reverting since now DevToolsBridgeClient (https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/devtools/device/webrtc/devtools_bridge_client.h) is that WebClient supposed to be. All further code will be placed there.
Original issue's description:
> Stub for web-base client for DevTools bridge and tests
>
> This patch mostly consists of testing environment for web WebClient. While
> WebClient intended to be base for a new DeviceProvider in DevTools frontend
> (https://codereview.chromium.org/720133002/) it is convinient to run
> tests on android. It lets to test the client directly against server
> counterpart avoiding flakiness of network and cloud services.
>
> TBR=jochen@chromium.org
> BUG=383418
>
> Committed: https://crrev.com/ff7a801dfddaa22643accaf3e0df192470fb7a7b
> Cr-Commit-Position: refs/heads/master@{#305131}
TBR=mnaganov@chromium.org,dgozman@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=383418
Review URL: https://codereview.chromium.org/802293002
Cr-Commit-Position: refs/heads/master@{#308329}
18 files changed, 28 insertions, 497 deletions
diff --git a/build/all.gyp b/build/all.gyp index ee72ddd..5f06ae0 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -885,7 +885,6 @@ ['enable_webrtc==1 and "<(libpeer_target_type)"=="static_library"', { 'dependencies': [ '../components/devtools_bridge.gyp:devtools_bridge_tests_apk', - '../components/devtools_bridge.gyp:libdevtools_bridge_browsertests', ], }], ], @@ -901,7 +900,6 @@ '../tools/android/android_tools.gyp:memconsumer', # Unit test bundles packaged as an apk. '../components/devtools_bridge.gyp:devtools_bridge_tests_apk', - '../components/devtools_bridge.gyp:libdevtools_bridge_browsertests', '../content/content_shell_and_tests.gyp:content_browsertests_apk', ], }, # target_name: android_builder_chromium_webrtc diff --git a/components/devtools_bridge.gyp b/components/devtools_bridge.gyp index a0faaa3..3dd104b 100644 --- a/components/devtools_bridge.gyp +++ b/components/devtools_bridge.gyp @@ -3,16 +3,12 @@ # found in the LICENSE file. { - 'includes': [ - '../build/util/version.gypi', - ], 'targets': [ { 'target_name': 'devtools_bridge_jni_headers', 'type': 'none', 'sources': [ 'devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/SessionDependencyFactoryNative.java', - 'devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java', ], 'variables': { 'jni_gen_package': 'devtools_bridge', @@ -20,38 +16,38 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { - 'target_name': 'devtools_bridge_server', + 'target_name': 'devtools_bridge', 'type': 'static_library', 'sources': [ 'devtools_bridge/android/session_dependency_factory_android.cc', 'devtools_bridge/android/session_dependency_factory_android.h', - 'devtools_bridge/session_dependency_factory.cc', - 'devtools_bridge/session_dependency_factory.h', 'devtools_bridge/socket_tunnel_connection.cc', 'devtools_bridge/socket_tunnel_connection.h', 'devtools_bridge/socket_tunnel_packet_handler.cc', 'devtools_bridge/socket_tunnel_packet_handler.h', 'devtools_bridge/socket_tunnel_server.cc', 'devtools_bridge/socket_tunnel_server.h', + 'devtools_bridge/session_dependency_factory.cc', + 'devtools_bridge/session_dependency_factory.h', ], 'dependencies': [ - '<(DEPTH)/base/base.gyp:base', - '<(DEPTH)/third_party/libjingle/libjingle.gyp:libjingle_webrtc', - '<(DEPTH)/third_party/libjingle/libjingle.gyp:libpeerconnection', - '<(DEPTH)/third_party/webrtc/base/base.gyp:webrtc_base', + '../base/base.gyp:base', + '../third_party/libjingle/libjingle.gyp:libjingle_webrtc', + '../third_party/libjingle/libjingle.gyp:libpeerconnection', + '../third_party/webrtc/base/base.gyp:webrtc_base', 'devtools_bridge_jni_headers', ], }, { - 'target_name': 'devtools_bridge_server_javalib', + 'target_name': 'devtools_bridge_javalib', 'type': 'none', 'variables': { 'java_in_dir': 'devtools_bridge/android/java', }, 'includes': [ '../build/java.gypi' ], 'dependencies': [ - '<(DEPTH)/base/base.gyp:base_java', - '<(DEPTH)/third_party/android_tools/android_tools.gyp:android_gcm', + '../third_party/android_tools/android_tools.gyp:android_gcm', + '../base/base.gyp:base_java', ], }, { @@ -61,8 +57,8 @@ 'devtools_bridge/test/android/javatests/jni/jni_onload.cc', ], 'dependencies': [ - '<(DEPTH)/base/base.gyp:base', - 'devtools_bridge_server', + '../base/base.gyp:base', + 'devtools_bridge', ], }, { @@ -73,14 +69,14 @@ }, 'includes': [ '../build/java.gypi' ], 'dependencies': [ - 'devtools_bridge_server_javalib', + 'devtools_bridge_javalib', ], }, { 'target_name': 'devtools_bridge_tests_apk', 'type': 'none', 'dependencies': [ - 'devtools_bridge_server_javalib', + 'devtools_bridge_javalib', 'devtools_bridge_testutils', 'libdevtools_bridge_natives_so', ], @@ -93,93 +89,5 @@ }, 'includes': [ '../build/java_apk.gypi' ], }, - { - 'target_name': 'libdevtools_bridge_browsertests', - 'type': 'shared_library', - 'sources': [ - 'devtools_bridge/test/android/client/javatests/jni/jni_onload.cc', - 'devtools_bridge/test/android/client/web_client_android.cc', - 'devtools_bridge/test/android/client/web_client_android.h', - ], - 'dependencies': [ - '<(DEPTH)/chrome/chrome.gyp:libchromeshell_base', - 'devtools_bridge_client', - 'devtools_bridge_jni_headers', - 'devtools_bridge_server', - ], - }, - { - 'target_name': 'devtools_bridge_browsertests_resources', - 'type': 'none', - 'dependencies': [ - '<(DEPTH)/chrome/chrome_resources.gyp:packed_resources', - ], - 'variables': { - 'asset_location': '<(PRODUCT_DIR)/devtools_bridge_browsertests_apk/assets', - }, - 'inputs': [ - '<(PRODUCT_DIR)/chrome_100_percent.pak', - '<(PRODUCT_DIR)/locales/en-US.pak', - '<(PRODUCT_DIR)/resources.pak', - ], - 'copies': [ - { - 'destination': '<(asset_location)', - 'files': [ - '<(PRODUCT_DIR)/chrome_100_percent.pak', - '<(PRODUCT_DIR)/locales/en-US.pak', - '<(PRODUCT_DIR)/resources.pak', - ], - 'conditions': [ - ['icu_use_data_file_flag==1', { - 'files': [ '<(PRODUCT_DIR)/icudtl.dat' ], - }], - ['v8_use_external_startup_data==1', { - 'files': [ - '<(PRODUCT_DIR)/natives_blob.bin', - '<(PRODUCT_DIR)/snapshot_blob.bin', - ], - }], - ], - }, - ], - }, - { - 'target_name': 'devtools_bridge_browsertests_apk', - 'type': 'none', - 'dependencies': [ - '<(DEPTH)/base/base.gyp:base_java', - '<(DEPTH)/chrome/chrome.gyp:chrome_java', - 'devtools_bridge_browsertests_resources', - 'devtools_bridge_server_javalib', - 'libdevtools_bridge_browsertests', - ], - 'variables': { - 'apk_name': 'DevToolsBridgeBrowserTests', - 'test_suite_name': 'devtools_bridge_tests', - 'java_in_dir': 'devtools_bridge/android/client/javatests', - 'additional_src_dirs': ['devtools_bridge/test/android/client/javatests'], - 'native_lib_target': 'libdevtools_bridge_browsertests', - 'asset_location': '<(PRODUCT_DIR)/devtools_bridge_browsertests_apk/assets', - 'native_lib_version_name': '<(version_full)', - 'is_test_apk': 1, - }, - 'includes': [ '../build/java_apk.gypi' ], - }, - - # TODO(serya): Separate from android targets. Otherwise it may not be - # used outside of android. - { - 'target_name': 'devtools_bridge_client', - 'type': 'static_library', - 'sources': [ - 'devtools_bridge/client/web_client.cc', - 'devtools_bridge/client/web_client.h', - ], - 'dependencies': [ - '<(DEPTH)/base/base.gyp:base', - '<(DEPTH)/content/content.gyp:content', - ], - }, ], } diff --git a/components/devtools_bridge/DEPS b/components/devtools_bridge/DEPS index d8f0c53..699e22a 100644 --- a/components/devtools_bridge/DEPS +++ b/components/devtools_bridge/DEPS @@ -1,4 +1,6 @@ include_rules = [ + "-chrome", + "-content", "+net", "+third_party/libjingle", "+third_party/webrtc", diff --git a/components/devtools_bridge/android/client/javatests/AndroidManifest.xml b/components/devtools_bridge/android/client/javatests/AndroidManifest.xml deleted file mode 100644 index 4ce7a2e..0000000 --- a/components/devtools_bridge/android/client/javatests/AndroidManifest.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?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. --> -<!-- 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.components.devtools_bridge.browsertests"> - - <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" /> - - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> - <uses-permission android:name="android.permission.CAMERA" /> - <uses-permission android:name="android.permission.GET_ACCOUNTS"/> - <uses-permission android:name="android.permission.INJECT_EVENTS" /> - <uses-permission android:name="android.permission.INTERNET"/> - <uses-permission android:name="android.permission.NFC"/> - <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/> - <uses-permission android:name="android.permission.RUN_INSTRUMENTATION" /> - <uses-permission android:name="android.permission.USE_CREDENTIALS" /> - <uses-permission android:name="android.permission.WAKE_LOCK"/> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> - <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> - <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> - - <application android:name=".TestApplication" - android:debuggable="true"> - <uses-library android:name="android.test.runner" /> - </application> - - <instrumentation android:name="android.test.InstrumentationTestRunner" - android:targetPackage="org.chromium.components.devtools_bridge.browsertests" - android:label="Tests for DevTols bride client"/> - -</manifest> diff --git a/components/devtools_bridge/android/client/javatests/DEPS b/components/devtools_bridge/android/client/javatests/DEPS deleted file mode 100644 index 5c694b9..0000000 --- a/components/devtools_bridge/android/client/javatests/DEPS +++ /dev/null @@ -1,4 +0,0 @@ -include_rules = [ - "+chrome", - "+content", -] diff --git a/components/devtools_bridge/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClientTest.java b/components/devtools_bridge/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClientTest.java deleted file mode 100644 index 2c4299d..0000000 --- a/components/devtools_bridge/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClientTest.java +++ /dev/null @@ -1,43 +0,0 @@ -// 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. - -package org.chromium.components.devtools_bridge; - -import android.test.InstrumentationTestCase; -import android.test.suitebuilder.annotation.SmallTest; - -import org.chromium.base.ThreadUtils; -import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.content.browser.BrowserStartupController; - -import java.util.concurrent.Callable; - -/** - * Tests for {@link WebClient}. WebClient is not intended to run on Android but - * it can. It is useful for tests: we can test it against the server in the - * same process (without dependency on network and cloud services). - */ -public class WebClientTest extends InstrumentationTestCase { - private Profile mProfile; - - protected void startChromeBrowserProcessSyncOnUIThread() throws Exception { - BrowserStartupController.get(getInstrumentation().getTargetContext()) - .startBrowserProcessesSync(false); - mProfile = Profile.getLastUsedProfile(); - } - - @SmallTest - public void testCreationWebClient() throws Exception { - ThreadUtils.runOnUiThreadBlocking(new Callable<Void>() { - @Override - public Void call() throws Exception { - startChromeBrowserProcessSyncOnUIThread(); - assert mProfile != null; - - new WebClient(mProfile).dispose(); - return null; - } - }); - } -} diff --git a/components/devtools_bridge/android/client/javatests/src/org/chromium/components/devtools_bridge/browsertests/TestApplication.java b/components/devtools_bridge/android/client/javatests/src/org/chromium/components/devtools_bridge/browsertests/TestApplication.java deleted file mode 100644 index ff55795..0000000 --- a/components/devtools_bridge/android/client/javatests/src/org/chromium/components/devtools_bridge/browsertests/TestApplication.java +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2013 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.components.devtools_bridge.browsertests; - -import android.content.Context; - -import org.chromium.base.CommandLine; -import org.chromium.base.PathUtils; -import org.chromium.base.ResourceExtractor; -import org.chromium.chrome.browser.ChromiumApplication; -import org.chromium.chrome.browser.PKCS11AuthenticationManager; -import org.chromium.net.AndroidPrivateKey; - -import java.security.cert.X509Certificate; - -/** - * Host application for DevTools Bridge client code tests. - */ -public class TestApplication extends ChromiumApplication { - private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "devtools_bridge"; - private static final String[] MANDATORY_PAKS = { - "en-US.pak", - "icudtl.dat", - "natives_blob.bin", - "resources.pak", - "snapshot_blob.bin" - }; - - @Override - public void onCreate() { - super.onCreate(); - ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAKS); - PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); - } - - @Override - public void initCommandLine() { - if (!CommandLine.isInitialized()) { - CommandLine.init(null); - } - } - - @Override - protected PKCS11AuthenticationManager getPKCS11AuthenticationManager() { - return new PKCS11AuthenticationManager() { - @Override - public boolean isPKCS11AuthEnabled() { - return false; - } - - @Override - public String getClientCertificateAlias(String hostName, int port) { - return null; - } - - @Override - public void initialize(Context context) { - } - - @Override - public X509Certificate[] getCertificateChain(String alias) { - return null; - } - - @Override - public AndroidPrivateKey getPrivateKey(String alias) { - return null; - } - }; - } - - @Override - protected boolean areParentalControlsEnabled() { - return false; - } -} diff --git a/components/devtools_bridge/android/session_dependency_factory_android.cc b/components/devtools_bridge/android/session_dependency_factory_android.cc index 7f3ea56..168f2fc 100644 --- a/components/devtools_bridge/android/session_dependency_factory_android.cc +++ b/components/devtools_bridge/android/session_dependency_factory_android.cc @@ -146,8 +146,8 @@ SessionDependencyFactoryAndroid::~SessionDependencyFactoryAndroid() { } // static -bool SessionDependencyFactoryAndroid::RegisterNatives(JNIEnv* env) { - return RegisterNativesImpl(env); +void SessionDependencyFactoryAndroid::RegisterNatives(JNIEnv* env) { + RegisterNativesImpl(env); } scoped_ptr<AbstractPeerConnection> diff --git a/components/devtools_bridge/android/session_dependency_factory_android.h b/components/devtools_bridge/android/session_dependency_factory_android.h index bfc8264..62ecae3 100644 --- a/components/devtools_bridge/android/session_dependency_factory_android.h +++ b/components/devtools_bridge/android/session_dependency_factory_android.h @@ -5,9 +5,8 @@ #ifndef COMPONENTS_DEVTOOLS_BRIDGE_ANDROID_SESSION_DEPENDENCY_FACTORY_ANDROID_H_ #define COMPONENTS_DEVTOOLS_BRIDGE_ANDROID_SESSION_DEPENDENCY_FACTORY_ANDROID_H_ -#include <jni.h> - #include "components/devtools_bridge/session_dependency_factory.h" +#include "jni.h" namespace devtools_bridge { namespace android { @@ -17,7 +16,7 @@ class SessionDependencyFactoryAndroid : public SessionDependencyFactory { SessionDependencyFactoryAndroid(); virtual ~SessionDependencyFactoryAndroid(); - static bool RegisterNatives(JNIEnv* env); + static void RegisterNatives(JNIEnv* env); virtual scoped_ptr<AbstractPeerConnection> CreatePeerConnection( scoped_ptr<RTCConfiguration> config, diff --git a/components/devtools_bridge/client/DEPS b/components/devtools_bridge/client/DEPS deleted file mode 100644 index 5bbc0c2..0000000 --- a/components/devtools_bridge/client/DEPS +++ /dev/null @@ -1,5 +0,0 @@ -include_rules = [ - "+content/public", - "-third_party/libjingle", - "-third_party/webrtc", -] diff --git a/components/devtools_bridge/client/web_client.cc b/components/devtools_bridge/client/web_client.cc deleted file mode 100644 index d323db5..0000000 --- a/components/devtools_bridge/client/web_client.cc +++ /dev/null @@ -1,37 +0,0 @@ -// 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 "components/devtools_bridge/client/web_client.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_delegate.h" - -namespace devtools_bridge { - -namespace { - -class WebClientImpl : public WebClient, private content::WebContentsDelegate { - public: - WebClientImpl(content::BrowserContext* context, Delegate* delegate); - - private: - Delegate* const delegate_; - const scoped_ptr<content::WebContents> web_contents_; -}; - -WebClientImpl::WebClientImpl(content::BrowserContext* context, - Delegate* delegate) - : delegate_(delegate), - web_contents_(content::WebContents::Create( - content::WebContents::CreateParams(context))) { - web_contents_->SetDelegate(this); -} - -} // namespace - -scoped_ptr<WebClient> WebClient::CreateInstance( - content::BrowserContext* context, Delegate* delegate) { - return make_scoped_ptr(new WebClientImpl(context, delegate)); -} - -} // namespace devtools_bridge diff --git a/components/devtools_bridge/client/web_client.h b/components/devtools_bridge/client/web_client.h deleted file mode 100644 index d980e87..0000000 --- a/components/devtools_bridge/client/web_client.h +++ /dev/null @@ -1,46 +0,0 @@ -// 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 COMPONENTS_DEVTOOLS_BRIDGE_CLIENT_WEB_CLIENT_H_ -#define COMPONENTS_DEVTOOLS_BRIDGE_CLIENT_WEB_CLIENT_H_ - -#include "base/memory/scoped_ptr.h" - -namespace content { -class BrowserContext; -} - -namespace devtools_bridge { - -/** - * Client for DevTools Bridge for desktop Chrome. Uses WebContents to host - * JavaScript implementation (therefore lives on the UI thread and must be - * destroyed before |context|). WebContents works as a sandbox for WebRTC - * related code. - */ -class WebClient { - public: - class Delegate { - public: - - // TODO(serya): implement - }; - - virtual ~WebClient() {} - - static scoped_ptr<WebClient> CreateInstance( - content::BrowserContext* context, Delegate* delegate); - - // TODO(serya): Implement. - - protected: - WebClient() {} - - private: - DISALLOW_COPY_AND_ASSIGN(WebClient); -}; - -} // namespace devtools_bridge - -#endif // COMPONENTS_DEVTOOLS_BRIDGE_CLIENT_WEB_CLIENT_H_ diff --git a/components/devtools_bridge/test/android/client/DEPS b/components/devtools_bridge/test/android/client/DEPS deleted file mode 100644 index 050660e..0000000 --- a/components/devtools_bridge/test/android/client/DEPS +++ /dev/null @@ -1,4 +0,0 @@ -include_rules = [ - "+chrome", - "+jni", -] diff --git a/components/devtools_bridge/test/android/client/javatests/jni/jni_onload.cc b/components/devtools_bridge/test/android/client/javatests/jni/jni_onload.cc deleted file mode 100644 index 3f35064..0000000 --- a/components/devtools_bridge/test/android/client/javatests/jni/jni_onload.cc +++ /dev/null @@ -1,30 +0,0 @@ -// 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 "base/android/base_jni_registrar.h" -#include "base/android/jni_android.h" -#include "base/android/library_loader/library_loader_hooks.h" -#include "chrome/app/android/chrome_android_initializer.h" -#include "chrome/app/android/chrome_main_delegate_android.h" -#include "components/devtools_bridge/android/session_dependency_factory_android.h" -#include "components/devtools_bridge/test/android/client/web_client_android.h" - -using namespace devtools_bridge::android; - -namespace { - -class Delegate : public ChromeMainDelegateAndroid { - public: - bool RegisterApplicationNativeMethods(JNIEnv* env) override { - return ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(env) && - SessionDependencyFactoryAndroid::InitializeSSL() && - WebClientAndroid::RegisterNatives(env); - } -}; - -} // namespace - -JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { - return RunChrome(vm, new Delegate()); -} diff --git a/components/devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java b/components/devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java deleted file mode 100644 index 896710e..0000000 --- a/components/devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java +++ /dev/null @@ -1,27 +0,0 @@ -// 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. - -package org.chromium.components.devtools_bridge; - -import org.chromium.base.JNINamespace; -import org.chromium.chrome.browser.profiles.Profile; - -/** - * Java wrapper over native WebClient for tests. - */ -@JNINamespace("devtools_bridge::android") -public final class WebClient { - private final long mWebClientPtr; - - public WebClient(Profile profile) { - mWebClientPtr = nativeCreateWebClient(profile); - } - - public void dispose() { - nativeDestroyWebClient(mWebClientPtr); - } - - private static native long nativeCreateWebClient(Profile profile); - private static native void nativeDestroyWebClient(long webClientPtr); -} diff --git a/components/devtools_bridge/test/android/client/web_client_android.cc b/components/devtools_bridge/test/android/client/web_client_android.cc deleted file mode 100644 index 8287a24..0000000 --- a/components/devtools_bridge/test/android/client/web_client_android.cc +++ /dev/null @@ -1,36 +0,0 @@ -// 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 "components/devtools_bridge/test/android/client/web_client_android.h" - -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_android.h" -#include "jni/WebClient_jni.h" - -namespace devtools_bridge { -namespace android { - -bool WebClientAndroid::RegisterNatives(JNIEnv* env) { - return RegisterNativesImpl(env); -} - -WebClientAndroid::WebClientAndroid(Profile* profile) - : impl_(WebClient::CreateInstance(profile, this)) { -} - -WebClientAndroid::~WebClientAndroid() { -} - -static jlong CreateWebClient(JNIEnv* env, jclass jcaller, jobject j_profile) { - Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); - return reinterpret_cast<jlong>(new WebClientAndroid(profile)); -} - -static void DestroyWebClient( - JNIEnv* env, jclass jcaller, jlong web_client_ptr) { - delete reinterpret_cast<WebClientAndroid*>(web_client_ptr); -} - -} // namespace android -} // namespace devtools_bridge diff --git a/components/devtools_bridge/test/android/client/web_client_android.h b/components/devtools_bridge/test/android/client/web_client_android.h deleted file mode 100644 index 9bca5bc..0000000 --- a/components/devtools_bridge/test/android/client/web_client_android.h +++ /dev/null @@ -1,34 +0,0 @@ -// 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 COMPONENTS_DEVTOOLS_BRIDGE_TEST_ANDROID_CLIENT_WEB_CLIENT_ANDROID_H_ -#define COMPONENTS_DEVTOOLS_BRIDGE_TEST_ANDROID_CLIENT_WEB_CLIENT_ANDROID_H_ - -#include <jni.h> - -#include "components/devtools_bridge/client/web_client.h" - -class Profile; - -namespace devtools_bridge { -namespace android { - -/** - * Android wrapper over WebClient for Java tests. See WebClientTest.java. - */ -class WebClientAndroid : private WebClient::Delegate { - public: - static bool RegisterNatives(JNIEnv* env); - - WebClientAndroid(Profile* profile); - ~WebClientAndroid(); - - private: - scoped_ptr<WebClient> impl_; -}; - -} // namespace android -} // namespace devtools_bridge - -#endif // COMPONENTS_DEVTOOLS_BRIDGE_TEST_ANDROID_CLIENT_WEB_CLIENT_ANDROID_H_ diff --git a/components/devtools_bridge/test/android/javatests/jni/jni_onload.cc b/components/devtools_bridge/test/android/javatests/jni/jni_onload.cc index 49fde3a..8fc74800 100644 --- a/components/devtools_bridge/test/android/javatests/jni/jni_onload.cc +++ b/components/devtools_bridge/test/android/javatests/jni/jni_onload.cc @@ -12,11 +12,15 @@ using namespace devtools_bridge::android; JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { base::android::InitVM(vm); JNIEnv* env = base::android::AttachCurrentThread(); - if (!base::android::RegisterLibraryLoaderEntryHook(env) || - !base::android::RegisterJni(env) || - !SessionDependencyFactoryAndroid::InitializeSSL() || - !SessionDependencyFactoryAndroid::RegisterNatives(env)) { + if (!base::android::RegisterLibraryLoaderEntryHook(env)) { return -1; } + if (!base::android::RegisterJni(env)) { + return -1; + } + if (!SessionDependencyFactoryAndroid::InitializeSSL()) { + return -1; + } + SessionDependencyFactoryAndroid::RegisterNatives(env); return JNI_VERSION_1_4; } |