| Index: content/browser/service_worker/service_worker_context_unittest.cc
|
| diff --git a/content/browser/service_worker/service_worker_context_unittest.cc b/content/browser/service_worker/service_worker_context_unittest.cc
|
| index 88870e2511145bb2f0bad075224461c344c3543f..2cc90ac82739458e457e3e27e72a2bcccb816a77 100644
|
| --- a/content/browser/service_worker/service_worker_context_unittest.cc
|
| +++ b/content/browser/service_worker/service_worker_context_unittest.cc
|
| @@ -583,41 +583,41 @@ TEST_F(ServiceWorkerContextTest, ProviderHostIterator) {
|
| int provider_id = 1;
|
|
|
| // Host1 (provider_id=1): process_id=1, origin1.
|
| - ServiceWorkerProviderHost* host1(new ServiceWorkerProviderHost(
|
| - kRenderProcessId1, MSG_ROUTING_NONE, provider_id++,
|
| - SERVICE_WORKER_PROVIDER_FOR_WINDOW,
|
| - ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
|
| - context()->AsWeakPtr(), nullptr));
|
| + std::unique_ptr<ServiceWorkerProviderHost> host1 =
|
| + ServiceWorkerProviderHost::CreateForTesting(
|
| + kRenderProcessId1, provider_id++, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
|
| + context()->AsWeakPtr());
|
| host1->SetDocumentUrl(kOrigin1);
|
|
|
| // Host2 (provider_id=2): process_id=2, origin2.
|
| - ServiceWorkerProviderHost* host2(new ServiceWorkerProviderHost(
|
| - kRenderProcessId2, MSG_ROUTING_NONE, provider_id++,
|
| - SERVICE_WORKER_PROVIDER_FOR_WINDOW,
|
| - ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
|
| - context()->AsWeakPtr(), nullptr));
|
| + std::unique_ptr<ServiceWorkerProviderHost> host2 =
|
| + ServiceWorkerProviderHost::CreateForTesting(
|
| + kRenderProcessId2, provider_id++, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
|
| + context()->AsWeakPtr());
|
| host2->SetDocumentUrl(kOrigin2);
|
|
|
| // Host3 (provider_id=3): process_id=2, origin1.
|
| - ServiceWorkerProviderHost* host3(new ServiceWorkerProviderHost(
|
| - kRenderProcessId2, MSG_ROUTING_NONE, provider_id++,
|
| - SERVICE_WORKER_PROVIDER_FOR_WINDOW,
|
| - ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
|
| - context()->AsWeakPtr(), nullptr));
|
| + std::unique_ptr<ServiceWorkerProviderHost> host3 =
|
| + ServiceWorkerProviderHost::CreateForTesting(
|
| + kRenderProcessId2, provider_id++, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
|
| + context()->AsWeakPtr());
|
| host3->SetDocumentUrl(kOrigin1);
|
|
|
| // Host4 (provider_id=4): process_id=2, origin2, for ServiceWorker.
|
| - ServiceWorkerProviderHost* host4(new ServiceWorkerProviderHost(
|
| - kRenderProcessId2, MSG_ROUTING_NONE, provider_id++,
|
| - SERVICE_WORKER_PROVIDER_FOR_CONTROLLER,
|
| - ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
|
| - context()->AsWeakPtr(), nullptr));
|
| + std::unique_ptr<ServiceWorkerProviderHost> host4 =
|
| + ServiceWorkerProviderHost::CreateForTesting(
|
| + kRenderProcessId2, provider_id++,
|
| + SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, context()->AsWeakPtr());
|
| host4->SetDocumentUrl(kOrigin2);
|
|
|
| - context()->AddProviderHost(base::WrapUnique(host1));
|
| - context()->AddProviderHost(base::WrapUnique(host2));
|
| - context()->AddProviderHost(base::WrapUnique(host3));
|
| - context()->AddProviderHost(base::WrapUnique(host4));
|
| + ServiceWorkerProviderHost* host1_raw = host1.get();
|
| + ServiceWorkerProviderHost* host2_raw = host2.get();
|
| + ServiceWorkerProviderHost* host3_raw = host3.get();
|
| + ServiceWorkerProviderHost* host4_raw = host4.get();
|
| + context()->AddProviderHost(std::move(host1));
|
| + context()->AddProviderHost(std::move(host2));
|
| + context()->AddProviderHost(std::move(host3));
|
| + context()->AddProviderHost(std::move(host4));
|
|
|
| // Iterate over all provider hosts.
|
| std::set<ServiceWorkerProviderHost*> results;
|
| @@ -626,10 +626,10 @@ TEST_F(ServiceWorkerContextTest, ProviderHostIterator) {
|
| results.insert(it->GetProviderHost());
|
| }
|
| EXPECT_EQ(4u, results.size());
|
| - EXPECT_TRUE(ContainsKey(results, host1));
|
| - EXPECT_TRUE(ContainsKey(results, host2));
|
| - EXPECT_TRUE(ContainsKey(results, host3));
|
| - EXPECT_TRUE(ContainsKey(results, host4));
|
| + EXPECT_TRUE(ContainsKey(results, host1_raw));
|
| + EXPECT_TRUE(ContainsKey(results, host2_raw));
|
| + EXPECT_TRUE(ContainsKey(results, host3_raw));
|
| + EXPECT_TRUE(ContainsKey(results, host4_raw));
|
|
|
| // Iterate over the client provider hosts that belong to kOrigin1.
|
| results.clear();
|
| @@ -638,8 +638,8 @@ TEST_F(ServiceWorkerContextTest, ProviderHostIterator) {
|
| results.insert(it->GetProviderHost());
|
| }
|
| EXPECT_EQ(2u, results.size());
|
| - EXPECT_TRUE(ContainsKey(results, host1));
|
| - EXPECT_TRUE(ContainsKey(results, host3));
|
| + EXPECT_TRUE(ContainsKey(results, host1_raw));
|
| + EXPECT_TRUE(ContainsKey(results, host3_raw));
|
|
|
| // Iterate over the provider hosts that belong to kOrigin2.
|
| // (This should not include host4 as it's not for controllee.)
|
| @@ -649,7 +649,7 @@ TEST_F(ServiceWorkerContextTest, ProviderHostIterator) {
|
| results.insert(it->GetProviderHost());
|
| }
|
| EXPECT_EQ(1u, results.size());
|
| - EXPECT_TRUE(ContainsKey(results, host2));
|
| + EXPECT_TRUE(ContainsKey(results, host2_raw));
|
|
|
| context()->RemoveProviderHost(kRenderProcessId1, 1);
|
| context()->RemoveProviderHost(kRenderProcessId2, 2);
|
|
|