Commit 05c0006e authored by clamy's avatar clamy Committed by Commit Bot

Always enable PlzNavigate

This CL ensures that PlzNavigate aka browser-side navigation is always
enabled. Renderer-side navigation is no longer supported.

BUG= 789577

Change-Id: Icc8f99966ae562799ebd44d077287970702d642f
Reviewed-on: https://chromium-review.googlesource.com/832651
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525330}
parent 562a3cf3
...@@ -146,105 +146,6 @@ TEST_F(ServiceWorkerProcessManagerTest, FindAvailableProcess) { ...@@ -146,105 +146,6 @@ TEST_F(ServiceWorkerProcessManagerTest, FindAvailableProcess) {
EXPECT_EQ(host3->GetID(), process_manager_->FindAvailableProcess(pattern_)); EXPECT_EQ(host3->GetID(), process_manager_->FindAvailableProcess(pattern_));
} }
// This tests the process host tracking by ServiceWorkerProcessManager
// which only is done when PlzNavigate is disabled.
TEST_F(ServiceWorkerProcessManagerTest,
AllocateWorkerProcess_FindAvailableProcess_NonPlzNavigate) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndDisableFeature(features::kBrowserSideNavigation);
const int kEmbeddedWorkerId1 = 100;
const int kEmbeddedWorkerId2 = 200;
const int kEmbeddedWorkerId3 = 300;
GURL scope1("http://example.com/scope1");
GURL scope2("http://example.com/scope2");
// Set up mock renderer process hosts.
std::unique_ptr<MockRenderProcessHost> host1(CreateRenderProcessHost());
std::unique_ptr<MockRenderProcessHost> host2(CreateRenderProcessHost());
process_manager_->AddProcessReferenceToPattern(scope1, host1->GetID());
process_manager_->AddProcessReferenceToPattern(scope2, host2->GetID());
ASSERT_EQ(0u, host1->GetKeepAliveRefCount());
ASSERT_EQ(0u, host2->GetKeepAliveRefCount());
std::map<int, ServiceWorkerProcessManager::ProcessInfo>& instance_info =
process_manager_->instance_info_;
// (1) Allocate a process to a worker.
ServiceWorkerProcessManager::AllocatedProcessInfo process_info;
ServiceWorkerStatusCode status = process_manager_->AllocateWorkerProcess(
kEmbeddedWorkerId1, scope1, script_url_,
true /* can_use_existing_process */, &process_info);
// An existing process should be allocated to the worker.
EXPECT_EQ(SERVICE_WORKER_OK, status);
EXPECT_EQ(host1->GetID(), process_info.process_id);
EXPECT_EQ(ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS,
process_info.start_situation);
EXPECT_EQ(1u, host1->GetKeepAliveRefCount());
EXPECT_EQ(0u, host2->GetKeepAliveRefCount());
EXPECT_EQ(1u, instance_info.size());
std::map<int, ServiceWorkerProcessManager::ProcessInfo>::iterator found =
instance_info.find(kEmbeddedWorkerId1);
ASSERT_TRUE(found != instance_info.end());
EXPECT_EQ(host1->GetID(), found->second.process_id);
// (2) Allocate a process to another worker whose scope is the same with the
// first worker.
status = process_manager_->AllocateWorkerProcess(
kEmbeddedWorkerId2, scope1, script_url_,
true /* can_use_existing_process */, &process_info);
// The same process should be allocated to the second worker.
EXPECT_EQ(SERVICE_WORKER_OK, status);
EXPECT_EQ(host1->GetID(), process_info.process_id);
EXPECT_EQ(ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS,
process_info.start_situation);
EXPECT_EQ(2u, host1->GetKeepAliveRefCount());
EXPECT_EQ(0u, host2->GetKeepAliveRefCount());
EXPECT_EQ(2u, instance_info.size());
found = instance_info.find(kEmbeddedWorkerId2);
ASSERT_TRUE(found != instance_info.end());
EXPECT_EQ(host1->GetID(), found->second.process_id);
// (3) Allocate a process to a third worker whose scope is different from
// other workers.
status = process_manager_->AllocateWorkerProcess(
kEmbeddedWorkerId3, scope2, script_url_,
true /* can_use_existing_process */, &process_info);
// A different existing process should be allocated to the third worker.
EXPECT_EQ(SERVICE_WORKER_OK, status);
EXPECT_EQ(host2->GetID(), process_info.process_id);
EXPECT_EQ(ServiceWorkerMetrics::StartSituation::EXISTING_READY_PROCESS,
process_info.start_situation);
EXPECT_EQ(2u, host1->GetKeepAliveRefCount());
EXPECT_EQ(1u, host2->GetKeepAliveRefCount());
EXPECT_EQ(3u, instance_info.size());
found = instance_info.find(kEmbeddedWorkerId3);
ASSERT_TRUE(found != instance_info.end());
EXPECT_EQ(host2->GetID(), found->second.process_id);
// The instance map should be updated by process release.
process_manager_->ReleaseWorkerProcess(kEmbeddedWorkerId3);
EXPECT_EQ(2u, host1->GetKeepAliveRefCount());
EXPECT_EQ(0u, host2->GetKeepAliveRefCount());
EXPECT_EQ(2u, instance_info.size());
EXPECT_TRUE(base::ContainsKey(instance_info, kEmbeddedWorkerId1));
EXPECT_TRUE(base::ContainsKey(instance_info, kEmbeddedWorkerId2));
process_manager_->ReleaseWorkerProcess(kEmbeddedWorkerId1);
EXPECT_EQ(1u, host1->GetKeepAliveRefCount());
EXPECT_EQ(0u, host2->GetKeepAliveRefCount());
EXPECT_EQ(1u, instance_info.size());
EXPECT_TRUE(base::ContainsKey(instance_info, kEmbeddedWorkerId2));
process_manager_->ReleaseWorkerProcess(kEmbeddedWorkerId2);
EXPECT_EQ(0u, host1->GetKeepAliveRefCount());
EXPECT_EQ(0u, host2->GetKeepAliveRefCount());
EXPECT_TRUE(instance_info.empty());
}
TEST_F(ServiceWorkerProcessManagerTest, TEST_F(ServiceWorkerProcessManagerTest,
AllocateWorkerProcess_WithProcessReuse) { AllocateWorkerProcess_WithProcessReuse) {
const int kEmbeddedWorkerId = 100; const int kEmbeddedWorkerId = 100;
......
...@@ -11,30 +11,7 @@ ...@@ -11,30 +11,7 @@
namespace content { namespace content {
bool IsBrowserSideNavigationEnabled() { bool IsBrowserSideNavigationEnabled() {
// First check if the network service is enabled or if PlzNavigate was return true;
// manually enabled via the --enable-browser-side-navigation flag. This takes
// precedence over other configuration. This ensure that tests that require
// PlzNavigate and manually set the command line flag or enable the network
// service will still work even if the test suite is ran with
// --disable-browser-side-navigation.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation) ||
base::FeatureList::IsEnabled(features::kNetworkService)) {
return true;
}
// Otherwise, disabling PlzNavigate through the command line flag
// --disable-browser-side-navigation has priority over the feature being
// enabled through the feature list. This ensures that test suites that run
// with --disable-browser-side-navigation do run with browser-side navigation
// disabled, even if the feature is enabled by default.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableBrowserSideNavigation)) {
return false;
}
// Otherwise, default to the feature list.
return base::FeatureList::IsEnabled(features::kBrowserSideNavigation);
} }
// Browser side navigation (aka PlzNavigate) is using blob URLs to deliver // Browser side navigation (aka PlzNavigate) is using blob URLs to deliver
......
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