Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: content/browser/service_worker/service_worker_request_handler_unittest.cc

Issue 894973003: ServiceWorker: Make "ready" fetches registration from browser process(2/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_request_handler.h" 5 #include "content/browser/service_worker/service_worker_request_handler.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/browser/fileapi/mock_url_request_delegate.h" 8 #include "content/browser/fileapi/mock_url_request_delegate.h"
9 #include "content/browser/service_worker/embedded_worker_test_helper.h" 9 #include "content/browser/service_worker/embedded_worker_test_helper.h"
10 #include "content/browser/service_worker/service_worker_context_core.h" 10 #include "content/browser/service_worker/service_worker_context_core.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 context()->AsWeakPtr()); 49 context()->AsWeakPtr());
50 50
51 // An empty host. 51 // An empty host.
52 scoped_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost( 52 scoped_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost(
53 kMockRenderProcessId, 53 kMockRenderProcessId,
54 MSG_ROUTING_NONE, 54 MSG_ROUTING_NONE,
55 kMockProviderId, 55 kMockProviderId,
56 SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE, 56 SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE,
57 context()->AsWeakPtr(), 57 context()->AsWeakPtr(),
58 nullptr)); 58 nullptr));
59 host->SetDocumentUrl(GURL("http://host/scope/"));
59 provider_host_ = host->AsWeakPtr(); 60 provider_host_ = host->AsWeakPtr();
60 context()->AddProviderHost(host.Pass()); 61 context()->AddProviderHost(host.Pass());
61 62
62 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); 63 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback));
63 base::RunLoop().RunUntilIdle(); 64 base::RunLoop().RunUntilIdle();
64 65
65 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); 66 version_->SetStatus(ServiceWorkerVersion::ACTIVATED);
66 registration_->SetActiveVersion(version_.get()); 67 registration_->SetActiveVersion(version_.get());
67 context()->storage()->StoreRegistration( 68 context()->storage()->StoreRegistration(
68 registration_.get(), 69 registration_.get(),
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 provider_host_->SetDocumentUrl(GURL("")); 155 provider_host_->SetDocumentUrl(GURL(""));
155 EXPECT_FALSE(InitializeHandlerCheck( 156 EXPECT_FALSE(InitializeHandlerCheck(
156 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); 157 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE));
157 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); 158 EXPECT_STREQ("", provider_host_->document_url().spec().c_str());
158 EXPECT_FALSE(InitializeHandlerCheck( 159 EXPECT_FALSE(InitializeHandlerCheck(
159 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); 160 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE));
160 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); 161 EXPECT_STREQ("", provider_host_->document_url().spec().c_str());
161 } 162 }
162 163
163 } // namespace content 164 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698