Commit 86076a10 authored by Wez's avatar Wez Committed by Commit Bot

[Fuchsia] Enable the NetworkService by default.

WebEngine appears to work correctly with NetworkService enabled, so
enable it.

Bug: 964161, b/130731732
Change-Id: I0a0566690a08a854553f2a526c4350cb9aa3be9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1613884
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661146}
parent 8555ae3d
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#include "net/cookies/cookie_store.h" #include "net/cookies/cookie_store.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_context_getter.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "url/url_constants.h" #include "url/url_constants.h"
...@@ -31,12 +34,18 @@ using testing::InvokeWithoutArgs; ...@@ -31,12 +34,18 @@ using testing::InvokeWithoutArgs;
namespace { namespace {
void OnNetworkServiceCookiesReceived(net::CookieList* output,
base::OnceClosure on_received_cb,
const net::CookieList& cookies) {
*output = cookies;
std::move(on_received_cb).Run();
}
void OnCookiesReceived(net::CookieList* output, void OnCookiesReceived(net::CookieList* output,
base::OnceClosure on_received_cb, base::OnceClosure on_received_cb,
const net::CookieList& cookies, const net::CookieList& cookies,
const net::CookieStatusList& excluded_cookies) { const net::CookieStatusList& cookie_status) {
*output = cookies; OnNetworkServiceCookiesReceived(output, std::move(on_received_cb), cookies);
std::move(on_received_cb).Run();
} }
// Defines a suite of tests that exercise browser-level configuration and // Defines a suite of tests that exercise browser-level configuration and
...@@ -54,22 +63,33 @@ class ContextImplTest : public cr_fuchsia::WebEngineBrowserTest { ...@@ -54,22 +63,33 @@ class ContextImplTest : public cr_fuchsia::WebEngineBrowserTest {
// Synchronously gets a list of cookies for this BrowserContext. // Synchronously gets a list of cookies for this BrowserContext.
net::CookieList GetCookies() { net::CookieList GetCookies() {
net::CookieStore* cookie_store =
content::BrowserContext::GetDefaultStoragePartition(
context_impl()->browser_context_for_test())
->GetURLRequestContext()
->GetURLRequestContext()
->cookie_store();
base::RunLoop run_loop; base::RunLoop run_loop;
net::CookieList cookies; net::CookieList cookies;
base::PostTaskWithTraits( network::mojom::CookieManagerPtr cookie_manager;
FROM_HERE, {content::BrowserThread::IO}, if (base::FeatureList::IsEnabled(network::features::kNetworkService)) {
base::BindOnce( content::BrowserContext::GetDefaultStoragePartition(
&net::CookieStore::GetAllCookiesAsync, context_impl()->browser_context_for_test())
base::Unretained(cookie_store), ->GetNetworkContext()
base::BindOnce(&OnCookiesReceived, base::Unretained(&cookies), ->GetCookieManager(mojo::MakeRequest(&cookie_manager));
run_loop.QuitClosure()))); cookie_manager->GetAllCookies(
base::BindOnce(&OnNetworkServiceCookiesReceived,
base::Unretained(&cookies), run_loop.QuitClosure()));
} else {
net::CookieStore* cookie_store =
content::BrowserContext::GetDefaultStoragePartition(
context_impl()->browser_context_for_test())
->GetURLRequestContext()
->GetURLRequestContext()
->cookie_store();
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(
&net::CookieStore::GetAllCookiesAsync,
base::Unretained(cookie_store),
base::BindOnce(&OnCookiesReceived, base::Unretained(&cookies),
run_loop.QuitClosure())));
}
run_loop.Run(); run_loop.Run();
return cookies; return cookies;
} }
......
...@@ -19,14 +19,13 @@ const base::Feature kNetworkErrorLogging{"NetworkErrorLogging", ...@@ -19,14 +19,13 @@ const base::Feature kNetworkErrorLogging{"NetworkErrorLogging",
// Enables the network service. // Enables the network service.
const base::Feature kNetworkService { const base::Feature kNetworkService {
"NetworkService", "NetworkService",
#if defined(OS_WIN) || defined(OS_MACOSX) || \ #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_FUCHSIA) || \
(defined(OS_LINUX) && !defined(IS_CHROMECAST)) (defined(OS_LINUX) && !defined(IS_CHROMECAST))
base::FEATURE_ENABLED_BY_DEFAULT base::FEATURE_ENABLED_BY_DEFAULT
};
#else #else
base::FEATURE_DISABLED_BY_DEFAULT base::FEATURE_DISABLED_BY_DEFAULT
};
#endif #endif
};
// Out of Blink CORS // Out of Blink CORS
const base::Feature kOutOfBlinkCors{"OutOfBlinkCors", const base::Feature kOutOfBlinkCors{"OutOfBlinkCors",
......
...@@ -111,6 +111,8 @@ component("sandbox") { ...@@ -111,6 +111,8 @@ component("sandbox") {
"//third_party/fuchsia-sdk/sdk:fonts", "//third_party/fuchsia-sdk/sdk:fonts",
"//third_party/fuchsia-sdk/sdk:logger", "//third_party/fuchsia-sdk/sdk:logger",
"//third_party/fuchsia-sdk/sdk:mediacodec", "//third_party/fuchsia-sdk/sdk:mediacodec",
"//third_party/fuchsia-sdk/sdk:net",
"//third_party/fuchsia-sdk/sdk:netstack",
"//third_party/fuchsia-sdk/sdk:sysmem", "//third_party/fuchsia-sdk/sdk:sysmem",
"//third_party/fuchsia-sdk/sdk:ui_scenic", "//third_party/fuchsia-sdk/sdk:ui_scenic",
] ]
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <fuchsia/fonts/cpp/fidl.h> #include <fuchsia/fonts/cpp/fidl.h>
#include <fuchsia/logger/cpp/fidl.h> #include <fuchsia/logger/cpp/fidl.h>
#include <fuchsia/mediacodec/cpp/fidl.h> #include <fuchsia/mediacodec/cpp/fidl.h>
#include <fuchsia/net/cpp/fidl.h>
#include <fuchsia/netstack/cpp/fidl.h>
#include <fuchsia/sysmem/cpp/fidl.h> #include <fuchsia/sysmem/cpp/fidl.h>
#include <fuchsia/ui/scenic/cpp/fidl.h> #include <fuchsia/ui/scenic/cpp/fidl.h>
#include <memory> #include <memory>
...@@ -61,20 +63,12 @@ constexpr SandboxConfig kSandboxConfigs[] = { ...@@ -61,20 +63,12 @@ constexpr SandboxConfig kSandboxConfigs[] = {
// Services directory is passed by calling SetServiceDirectory(). // Services directory is passed by calling SetServiceDirectory().
base::span<const char* const>(), base::span<const char* const>(),
// kCloneJob: context process needs to be able to spawn child processes. // kCloneJob: Allow Contexts to launch child processes.
// kProvideVulkanResources: Vulkan access is required to delegate to the // kProvideVulkanResources: Context delegates this to the GPU process.
// GPU process. kProvideSslConfig: Context process is responsible for // kProvideSslConfig: Context delegates this to the NetworkService.
// cert verification.
kCloneJob | kProvideVulkanResources | kProvideSslConfig | kCloneJob | kProvideVulkanResources | kProvideSslConfig |
kUseServiceDirectoryOverride, kUseServiceDirectoryOverride,
}, },
{
SANDBOX_TYPE_RENDERER,
base::make_span(
(const char* const[]){fuchsia::fonts::Provider::Name_,
fuchsia::mediacodec::CodecFactory::Name_}),
0,
},
{ {
SANDBOX_TYPE_GPU, SANDBOX_TYPE_GPU,
base::make_span((const char* const[]){ base::make_span((const char* const[]){
...@@ -82,6 +76,20 @@ constexpr SandboxConfig kSandboxConfigs[] = { ...@@ -82,6 +76,20 @@ constexpr SandboxConfig kSandboxConfigs[] = {
fuchsia::sysmem::Allocator::Name_, "fuchsia.vulkan.loader.Loader"}), fuchsia::sysmem::Allocator::Name_, "fuchsia.vulkan.loader.Loader"}),
kProvideVulkanResources, kProvideVulkanResources,
}, },
{
SANDBOX_TYPE_NETWORK,
base::make_span(
(const char* const[]){fuchsia::net::SocketProvider::Name_,
fuchsia::netstack::Netstack::Name_}),
kProvideSslConfig,
},
{
SANDBOX_TYPE_RENDERER,
base::make_span(
(const char* const[]){fuchsia::fonts::Provider::Name_,
fuchsia::mediacodec::CodecFactory::Name_}),
0,
},
}; };
constexpr SandboxConfig kDefaultConfig = { constexpr SandboxConfig kDefaultConfig = {
......
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