Commit 09928a3d authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Fix HTTPS embedded test server with network service on Android

When running tests with network service enabled, we need to
initialize NetworkServiceTestHelper to register test certs
and perform other setup in the network process. This does the
necessary setup for Android, similar to what is alredy being
done for desktop here:
https://cs.chromium.org/chromium/src/chrome/test/base/chrome_test_launcher.cc?l=167&rcl=024b72104d153da4c609c19d09facb8bd48632b6

Bug: 888020
Change-Id: I7016c42ff59169eb4f32b8531a83266b120a65fe
Reviewed-on: https://chromium-review.googlesource.com/c/1306665Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604106}
parent 4b43eb8b
......@@ -1068,6 +1068,7 @@ chrome_shared_library("libchromefortest") {
"//components/heap_profiling:test_support",
"//components/minidump_uploader",
"//content/public/test/android:content_native_test_support",
"//content/test:test_support",
]
if (enable_vr) {
sources += [ "../browser/android/vr/register_jni.cc" ]
......
......@@ -17,5 +17,9 @@ specific_include_rules = {
# Special-case where monochrome composes chrome+webview
"monochrome_entry_point\.cc": [
"+android_webview",
]
],
# Allowed for test setup.
"chrome_entry_point_for_test\.cc": [
"+chrome/utility/chrome_content_utility_client.h",
],
}
......@@ -6,13 +6,42 @@
#include "base/android/jni_utils.h"
#include "base/android/library_loader/library_loader_hooks.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/no_destructor.h"
#include "base/test/test_support_android.h"
#include "chrome/app/android/chrome_jni_onload.h"
#include "chrome/browser/android/chrome_jni_for_test_registration.h"
#include "chrome/utility/chrome_content_utility_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/network_service_test_helper.h"
#include "services/service_manager/sandbox/switches.h"
namespace {
content::NetworkServiceTestHelper* GetNetworkServiceTestHelper() {
static base::NoDestructor<content::NetworkServiceTestHelper> instance;
return instance.get();
}
bool NativeInit(base::android::LibraryProcessType) {
// Setup a working test environment for the network service in case it's used.
// Only create this object in the utility process, so that its members don't
// interfere with other test objects in the browser process.
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->GetSwitchValueASCII(switches::kProcessType) ==
switches::kUtilityProcess &&
command_line->GetSwitchValueASCII(
service_manager::switches::kServiceSandboxType) ==
service_manager::switches::kNetworkSandbox) {
ChromeContentUtilityClient::SetNetworkBinderCreationCallback(
base::BindRepeating(
[](content::NetworkServiceTestHelper* helper,
service_manager::BinderRegistry* registry) {
helper->RegisterNetworkBinders(registry);
},
GetNetworkServiceTestHelper()));
}
return android::OnJNIOnLoadInit();
}
......
......@@ -15,12 +15,3 @@
-org.chromium.chrome.browser.appmenu.DataSaverAppMenuTest.testMenuDataSaverPersistent
-org.chromium.chrome.browser.customtabs.CustomTabActivityTest.testLaunchWebLiteURL
-org.chromium.chrome.browser.infobar.InfoBarTest.testDataReductionPromoInfoBar
# https://crbug.com/888020
# These only fail with OOP network service.
-org.chromium.chrome.browser.HTTPSTabsOpenedFromExternalAppTest.testReferrerPolicyHttpReferrerHttpsNavigationsPolicyDefault
-org.chromium.chrome.browser.share.ShareMenuActionHandlerIntegrationTest.testCanonicalUrlsOverHttps
-org.chromium.chrome.browser.omnibox.OmniboxTest.testHttpsLocationBarColor
-org.chromium.chrome.browser.omnibox.OmniboxTest.testSecurityIconOnHTTPS
-org.chromium.chrome.browser.ssl.CaptivePortalTest.testCaptivePortalCertificateListFeature
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment