Move Content sandbox test support into Content
This code was originally landed when sandbox stuff was still in Service Manager. It's not in Service Manager anymore, and Service Manager code is on its way to the great Git repository in the sky. Bug: 977637 Change-Id: I10c2c02cbd70bc3f99fb0dfdb26319003b0047c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2520317 Auto-Submit: Ken Rockot <rockot@google.com> Commit-Queue: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Cr-Commit-Position: refs/heads/master@{#824301}
This commit is contained in:
content
browser
shell
test
services/service_manager/tests
@ -67,7 +67,7 @@
|
||||
#include "content/shell/browser/shell.h"
|
||||
#include "content/shell/browser/shell_javascript_dialog_manager.h"
|
||||
#include "content/test/content_browser_test_utils_internal.h"
|
||||
#include "content/test/echo.mojom.h"
|
||||
#include "content/test/echo.test-mojom.h"
|
||||
#include "media/base/media_switches.h"
|
||||
#include "mojo/public/cpp/bindings/message.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/test/navigation_simulator.h"
|
||||
#include "content/public/test/test_renderer_host.h"
|
||||
#include "content/test/echo.mojom.h"
|
||||
#include "content/test/echo.test-mojom.h"
|
||||
#include "content/test/test_render_frame_host.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
@ -16,10 +16,10 @@
|
||||
#include "content/public/test/browser_test.h"
|
||||
#include "content/public/test/content_browser_test.h"
|
||||
#include "content/public/test/test_service.mojom.h"
|
||||
#include "content/test/sandbox_status.test-mojom.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "sandbox/policy/linux/sandbox_linux.h"
|
||||
#include "sandbox/policy/switches.h"
|
||||
#include "services/service_manager/tests/sandbox_status.test-mojom.h"
|
||||
|
||||
using sandbox::policy::SandboxLinux;
|
||||
using sandbox::policy::SandboxType;
|
||||
@ -149,10 +149,8 @@ class UtilityProcessSandboxBrowserTest
|
||||
std::move(quit_closure).Run();
|
||||
}
|
||||
|
||||
mojo::Remote<service_manager::mojom::SandboxStatusService> service_;
|
||||
mojo::Remote<mojom::SandboxStatusService> service_;
|
||||
base::OnceClosure done_closure_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(UtilityProcessSandboxBrowserTest);
|
||||
};
|
||||
|
||||
IN_PROC_BROWSER_TEST_P(UtilityProcessSandboxBrowserTest, VerifySandboxType) {
|
||||
|
@ -292,10 +292,6 @@ static_library("content_shell_lib") {
|
||||
deps += [ "//gin" ]
|
||||
}
|
||||
|
||||
if (is_linux || is_chromeos) {
|
||||
deps += [ "//services/service_manager/tests:sandbox_status_service" ]
|
||||
}
|
||||
|
||||
if (use_gtk) {
|
||||
deps += [ "//ui/gtk" ]
|
||||
if (use_x11 || ozone_platform_x11) {
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "services/test/echo/echo_service.h"
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
#include "services/service_manager/tests/sandbox_status_service.h"
|
||||
#include "content/test/sandbox_status_service.h"
|
||||
#endif
|
||||
|
||||
namespace content {
|
||||
@ -145,9 +145,9 @@ void ShellContentUtilityClient::ExposeInterfacesToBrowser(
|
||||
base::ThreadTaskRunnerHandle::Get());
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
if (register_sandbox_status_helper_) {
|
||||
binders->Add<service_manager::mojom::SandboxStatusService>(
|
||||
binders->Add<content::mojom::SandboxStatusService>(
|
||||
base::BindRepeating(
|
||||
&service_manager::SandboxStatusService::MakeSelfOwnedReceiver),
|
||||
&content::SandboxStatusService::MakeSelfOwnedReceiver),
|
||||
base::ThreadTaskRunnerHandle::Get());
|
||||
}
|
||||
#endif
|
||||
|
@ -374,6 +374,7 @@ static_library("test_support") {
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
":test_interfaces",
|
||||
"//components/download/public/common:test_support",
|
||||
"//components/services/storage/public/mojom",
|
||||
"//content/public/app",
|
||||
@ -630,6 +631,13 @@ static_library("test_support") {
|
||||
if (chromeos_is_browser_only) {
|
||||
deps += [ "//chromeos/lacros" ]
|
||||
}
|
||||
|
||||
if (is_linux || is_chromeos) {
|
||||
sources += [
|
||||
"sandbox_status_service.cc",
|
||||
"sandbox_status_service.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# Fuchsia gpu integration tests use web_engine and a browser like shell
|
||||
@ -826,7 +834,10 @@ mojom("mojo_web_test_bindings") {
|
||||
|
||||
mojom("test_interfaces") {
|
||||
testonly = true
|
||||
sources = [ "echo.mojom" ]
|
||||
sources = [ "echo.test-mojom" ]
|
||||
if (is_linux || is_chromeos) {
|
||||
sources += [ "sandbox_status.test-mojom" ]
|
||||
}
|
||||
}
|
||||
|
||||
mojom("mojo_bindings_web_test_mojom") {
|
||||
@ -1213,6 +1224,7 @@ test("content_browsertests") {
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
":test_interfaces",
|
||||
":web_ui_mojo_test_resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
@ -1221,7 +1233,6 @@ test("content_browsertests") {
|
||||
deps = [
|
||||
":browsertest_support",
|
||||
":content_test_mojo_bindings",
|
||||
":test_interfaces",
|
||||
":test_support",
|
||||
":web_ui_mojo_test_js_type_check",
|
||||
":web_ui_test_mojo_bindings",
|
||||
@ -1433,10 +1444,7 @@ test("content_browsertests") {
|
||||
"../browser/utility_process_sandbox_browsertest.cc",
|
||||
"../browser/zygote_host/zygote_browsertest.cc",
|
||||
]
|
||||
deps += [
|
||||
"//services/service_manager/tests:interfaces",
|
||||
"//ui/gfx:test_support",
|
||||
]
|
||||
deps += [ "//ui/gfx:test_support" ]
|
||||
|
||||
if (use_atk) {
|
||||
sources += [
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
module service_manager.mojom;
|
||||
module content.mojom;
|
||||
|
||||
// Interface used in testing the Linux sandbox status in
|
||||
// content/browser/utility_process_sandbox_browsertest.cc.
|
@ -2,12 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "services/service_manager/tests/sandbox_status_service.h"
|
||||
#include "content/test/sandbox_status_service.h"
|
||||
|
||||
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
||||
#include "sandbox/policy/linux/sandbox_linux.h"
|
||||
|
||||
namespace service_manager {
|
||||
namespace content {
|
||||
|
||||
// static
|
||||
void SandboxStatusService::MakeSelfOwnedReceiver(
|
||||
@ -25,4 +25,4 @@ void SandboxStatusService::GetSandboxStatus(GetSandboxStatusCallback callback) {
|
||||
sandbox::policy::SandboxLinux::GetInstance()->GetStatus());
|
||||
}
|
||||
|
||||
} // namespace service_manager
|
||||
} // namespace content
|
@ -2,15 +2,14 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SERVICES_SERVICE_MANAGER_TESTS_SANDBOX_STATUS_SERVICE_H_
|
||||
#define SERVICES_SERVICE_MANAGER_TESTS_SANDBOX_STATUS_SERVICE_H_
|
||||
#ifndef CONTENT_TEST_SANDBOX_STATUS_SERVICE_H_
|
||||
#define CONTENT_TEST_SANDBOX_STATUS_SERVICE_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "content/test/sandbox_status.test-mojom.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "services/service_manager/tests/sandbox_status.test-mojom.h"
|
||||
|
||||
namespace service_manager {
|
||||
namespace content {
|
||||
|
||||
class SandboxStatusService : public mojom::SandboxStatusService {
|
||||
public:
|
||||
@ -18,15 +17,15 @@ class SandboxStatusService : public mojom::SandboxStatusService {
|
||||
mojo::PendingReceiver<mojom::SandboxStatusService> receiver);
|
||||
|
||||
SandboxStatusService();
|
||||
SandboxStatusService(const SandboxStatusService&) = delete;
|
||||
SandboxStatusService& operator=(const SandboxStatusService&) = delete;
|
||||
~SandboxStatusService() override;
|
||||
|
||||
private:
|
||||
// mojom::SandboxStatusService:
|
||||
void GetSandboxStatus(GetSandboxStatusCallback callback) override;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SandboxStatusService);
|
||||
};
|
||||
|
||||
} // namespace service_manager
|
||||
} // namespace content
|
||||
|
||||
#endif // SERVICES_SERVICE_MANAGER_TESTS_SANDBOX_STATUS_SERVICE_H_
|
||||
#endif // CONTENT_TEST_SANDBOX_STATUS_SERVICE_H_
|
@ -51,28 +51,6 @@ mojom("interfaces") {
|
||||
"background.test-mojom",
|
||||
"test_support.test-mojom",
|
||||
]
|
||||
|
||||
if (is_linux || is_chromeos) {
|
||||
sources += [ "sandbox_status.test-mojom" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_linux || is_chromeos) {
|
||||
source_set("sandbox_status_service") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"sandbox_status_service.cc",
|
||||
"sandbox_status_service.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":interfaces",
|
||||
"//base",
|
||||
"//sandbox/policy",
|
||||
"//services/service_manager/public/cpp",
|
||||
"//services/service_manager/public/mojom",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
source_set("util") {
|
||||
|
Reference in New Issue
Block a user