Commit 7e88dd5e authored by Robbie McElrath's avatar Robbie McElrath Committed by Commit Bot

Fix SingleProcessBrowserTest.Test on ChromeOS.

Bug: 927435
Change-Id: Ic1f17615bc5f4f6f2f2c02d8c3557c9ade7d1bc0
Reviewed-on: https://chromium-review.googlesource.com/c/1450200
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#628476}
parent 9f1e2929
...@@ -5,15 +5,14 @@ ...@@ -5,15 +5,14 @@
#include "chrome/browser/chromeos/network_change_manager_client.h" #include "chrome/browser/chromeos/network_change_manager_client.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/feature_list.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/network/network_event_log.h" #include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_state.h" #include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_state_handler.h"
#include "content/public/browser/network_service_instance.h" #include "content/public/browser/network_service_instance.h"
#include "content/public/common/network_service_util.h"
#include "net/base/network_change_notifier_chromeos.h" #include "net/base/network_change_notifier_chromeos.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/network_service.mojom.h" #include "services/network/public/mojom/network_service.mojom.h"
namespace chromeos { namespace chromeos {
...@@ -26,7 +25,7 @@ NetworkChangeManagerClient::NetworkChangeManagerClient( ...@@ -26,7 +25,7 @@ NetworkChangeManagerClient::NetworkChangeManagerClient(
DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE); NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE);
if (base::FeatureList::IsEnabled(network::features::kNetworkService)) if (content::IsOutOfProcessNetworkService())
ConnectToNetworkChangeManager(); ConnectToNetworkChangeManager();
// Update initial connection state. // Update initial connection state.
...@@ -38,7 +37,7 @@ NetworkChangeManagerClient::~NetworkChangeManagerClient() { ...@@ -38,7 +37,7 @@ NetworkChangeManagerClient::~NetworkChangeManagerClient() {
NetworkHandler::Get()->network_state_handler()->RemoveObserver(this, NetworkHandler::Get()->network_state_handler()->RemoveObserver(this,
FROM_HERE); FROM_HERE);
DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
}; }
void NetworkChangeManagerClient::SuspendDone( void NetworkChangeManagerClient::SuspendDone(
const base::TimeDelta& sleep_duration) { const base::TimeDelta& sleep_duration) {
......
...@@ -97,9 +97,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, AfterStartupTaskUtils) { ...@@ -97,9 +97,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, AfterStartupTaskUtils) {
// On Mac this crashes inside cc::SingleThreadProxy::SetNeedsCommit. See // On Mac this crashes inside cc::SingleThreadProxy::SetNeedsCommit. See
// https://ci.chromium.org/b/8923336499994443392 // https://ci.chromium.org/b/8923336499994443392
// On ChromeOS this crashes because ProfileIOData and NetworkContext both try #if !defined(OS_MACOSX)
// to set up NSS on different threads, which it doesn't like.
#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
class SingleProcessBrowserTest : public InProcessBrowserTest { class SingleProcessBrowserTest : public InProcessBrowserTest {
public: public:
void SetUpCommandLine(base::CommandLine* command_line) override { void SetUpCommandLine(base::CommandLine* command_line) override {
......
...@@ -123,8 +123,17 @@ base::LazyInstance<std::map<std::string, base::WeakPtr<UtilityProcessHost>>>:: ...@@ -123,8 +123,17 @@ base::LazyInstance<std::map<std::string, base::WeakPtr<UtilityProcessHost>>>::
// If enabled, network service will run in it's own thread when running // If enabled, network service will run in it's own thread when running
// in-process, otherwise it is run on the IO thread. // in-process, otherwise it is run on the IO thread.
// On ChromeOS the network service has to run on the IO thread because
// ProfileIOData and NetworkContext both try to set up NSS, which has has to be
// called from the IO thread.
const base::Feature kNetworkServiceDedicatedThread{ const base::Feature kNetworkServiceDedicatedThread{
"NetworkServiceDedicatedThread", base::FEATURE_ENABLED_BY_DEFAULT}; "NetworkServiceDedicatedThread",
#if defined(OS_CHROMEOS)
base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_ENABLED_BY_DEFAULT
#endif
};
void DestroyConnectorOnIOThread() { g_io_thread_connector.Get().reset(); } void DestroyConnectorOnIOThread() { g_io_thread_connector.Get().reset(); }
......
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