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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host_unittest.cc

Issue 1042933002: ServiceWorker: Support non-window clients in Clients.matchAll (1/2 chromium) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
index cd3a49e9590dc410a60231fb5312ef212a3aacd7..109331043f50ce576bb9b2b6f86b2bb8021dc97e 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
@@ -130,12 +130,10 @@ class ServiceWorkerDispatcherHostTest : public testing::Test {
}
ServiceWorkerProviderHost* CreateServiceWorkerProviderHost(int provider_id) {
- return new ServiceWorkerProviderHost(kRenderProcessId,
- kRenderFrameId,
- provider_id,
- SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE,
- context()->AsWeakPtr(),
- dispatcher_host_.get());
+ return new ServiceWorkerProviderHost(
+ kRenderProcessId, kRenderFrameId, provider_id,
+ SERVICE_WORKER_PROVIDER_FOR_WINDOW, context()->AsWeakPtr(),
+ dispatcher_host_.get());
}
@@ -408,17 +406,13 @@ TEST_F(ServiceWorkerDispatcherHostTest, EarlyContextDeletion) {
TEST_F(ServiceWorkerDispatcherHostTest, ProviderCreatedAndDestroyed) {
const int kProviderId = 1001; // Test with a value != kRenderProcessId.
- dispatcher_host_->OnMessageReceived(
- ServiceWorkerHostMsg_ProviderCreated(
- kProviderId, MSG_ROUTING_NONE,
- SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE));
+ dispatcher_host_->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated(
+ kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW));
EXPECT_TRUE(context()->GetProviderHost(kRenderProcessId, kProviderId));
// Two with the same ID should be seen as a bad message.
- dispatcher_host_->OnMessageReceived(
- ServiceWorkerHostMsg_ProviderCreated(
- kProviderId, MSG_ROUTING_NONE,
- SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE));
+ dispatcher_host_->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated(
+ kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW));
EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_);
dispatcher_host_->OnMessageReceived(
@@ -432,10 +426,8 @@ TEST_F(ServiceWorkerDispatcherHostTest, ProviderCreatedAndDestroyed) {
// Deletion of the dispatcher_host should cause providers for that
// process to get deleted as well.
- dispatcher_host_->OnMessageReceived(
- ServiceWorkerHostMsg_ProviderCreated(
- kProviderId, MSG_ROUTING_NONE,
- SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE));
+ dispatcher_host_->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated(
+ kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW));
EXPECT_TRUE(context()->GetProviderHost(kRenderProcessId, kProviderId));
EXPECT_TRUE(dispatcher_host_->HasOneRef());
dispatcher_host_ = NULL;
@@ -503,10 +495,8 @@ TEST_F(ServiceWorkerDispatcherHostTest, GetRegistration_EarlyContextDeletion) {
TEST_F(ServiceWorkerDispatcherHostTest, CleanupOnRendererCrash) {
// Add a provider and worker.
const int64 kProviderId = 99; // Dummy value
- dispatcher_host_->OnMessageReceived(
- ServiceWorkerHostMsg_ProviderCreated(
- kProviderId, MSG_ROUTING_NONE,
- SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE));
+ dispatcher_host_->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated(
+ kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW));
GURL pattern = GURL("http://www.example.com/");
scoped_refptr<ServiceWorkerRegistration> registration(
@@ -564,10 +554,8 @@ TEST_F(ServiceWorkerDispatcherHostTest, CleanupOnRendererCrash) {
// To show the new dispatcher can operate, simulate provider creation. Since
// the old dispatcher cleaned up the old provider host, the new one won't
// complain.
- new_dispatcher_host->OnMessageReceived(
- ServiceWorkerHostMsg_ProviderCreated(
- kProviderId, MSG_ROUTING_NONE,
- SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE));
+ new_dispatcher_host->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated(
+ kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW));
EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_);
}

Powered by Google App Engine
This is Rietveld 408576698