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 408fb4f86e9baf950aea8a24db64e5e2127658ed..f294a397d3c4d56f327e7486bb1a7d0e11dbd8f8 100644 |
--- a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc |
+++ b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc |
@@ -22,6 +22,7 @@ |
#include "content/browser/service_worker/service_worker_context_core.h" |
#include "content/browser/service_worker/service_worker_context_wrapper.h" |
#include "content/browser/service_worker/service_worker_handle.h" |
+#include "content/browser/service_worker/service_worker_test_utils.h" |
#include "content/common/service_worker/embedded_worker_messages.h" |
#include "content/common/service_worker/service_worker_messages.h" |
#include "content/common/service_worker/service_worker_types.h" |
@@ -260,6 +261,9 @@ class ServiceWorkerDispatcherHostTest : public testing::Test { |
ServiceWorkerProviderHost* provider_host_; |
}; |
+class ServiceWorkerDispatcherHostTestP |
+ : public MojoServiceWorkerTestP<ServiceWorkerDispatcherHostTest> {}; |
+ |
class ServiceWorkerTestContentBrowserClient : public TestContentBrowserClient { |
public: |
ServiceWorkerTestContentBrowserClient() {} |
@@ -272,7 +276,7 @@ class ServiceWorkerTestContentBrowserClient : public TestContentBrowserClient { |
} |
}; |
-TEST_F(ServiceWorkerDispatcherHostTest, |
+TEST_P(ServiceWorkerDispatcherHostTestP, |
Register_ContentSettingsDisallowsServiceWorker) { |
ServiceWorkerTestContentBrowserClient test_browser_client; |
ContentBrowserClient* old_browser_client = |
@@ -306,7 +310,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, |
SetBrowserClientForTesting(old_browser_client); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, Register_HTTPS) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, Register_HTTPS) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -319,7 +323,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_HTTPS) { |
ServiceWorkerMsg_ServiceWorkerRegistered::ID); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, Register_NonSecureTransportLocalhost) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, Register_NonSecureTransportLocalhost) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -332,7 +336,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_NonSecureTransportLocalhost) { |
ServiceWorkerMsg_ServiceWorkerRegistered::ID); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, Register_InvalidScopeShouldFail) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, Register_InvalidScopeShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -344,7 +348,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_InvalidScopeShouldFail) { |
EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, Register_InvalidScriptShouldFail) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, Register_InvalidScriptShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -355,7 +359,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_InvalidScriptShouldFail) { |
EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, Register_NonSecureOriginShouldFail) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, Register_NonSecureOriginShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -368,7 +372,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_NonSecureOriginShouldFail) { |
EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, Register_CrossOriginShouldFail) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, Register_CrossOriginShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -412,7 +416,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_CrossOriginShouldFail) { |
EXPECT_EQ(6, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, Register_BadCharactersShouldFail) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, Register_BadCharactersShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -444,7 +448,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_BadCharactersShouldFail) { |
EXPECT_EQ(6, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, |
+TEST_P(ServiceWorkerDispatcherHostTestP, |
Register_FileSystemDocumentShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
@@ -468,7 +472,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, |
EXPECT_EQ(3, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, |
+TEST_P(ServiceWorkerDispatcherHostTestP, |
Register_FileSystemScriptOrScopeShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
@@ -492,7 +496,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, |
EXPECT_EQ(3, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, EarlyContextDeletion) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, EarlyContextDeletion) { |
helper_->ShutdownContext(); |
// Let the shutdown reach the simulated IO thread. |
@@ -504,7 +508,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, EarlyContextDeletion) { |
ServiceWorkerMsg_ServiceWorkerRegistrationError::ID); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, ProviderCreatedAndDestroyed) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, ProviderCreatedAndDestroyed) { |
const int kProviderId = 1001; |
int process_id = helper_->mock_render_process_id(); |
@@ -539,7 +543,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, ProviderCreatedAndDestroyed) { |
EXPECT_FALSE(context()->GetProviderHost(process_id, kProviderId)); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, GetRegistration_SameOrigin) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, GetRegistration_SameOrigin) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -551,7 +555,8 @@ TEST_F(ServiceWorkerDispatcherHostTest, GetRegistration_SameOrigin) { |
ServiceWorkerMsg_DidGetRegistration::ID); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, GetRegistration_CrossOriginShouldFail) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, |
+ GetRegistration_CrossOriginShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -562,7 +567,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, GetRegistration_CrossOriginShouldFail) { |
EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, |
+TEST_P(ServiceWorkerDispatcherHostTestP, |
GetRegistration_InvalidScopeShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
@@ -574,7 +579,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, |
EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, |
+TEST_P(ServiceWorkerDispatcherHostTestP, |
GetRegistration_NonSecureOriginShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
@@ -586,7 +591,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, |
EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, GetRegistration_EarlyContextDeletion) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, GetRegistration_EarlyContextDeletion) { |
helper_->ShutdownContext(); |
// Let the shutdown reach the simulated IO thread. |
@@ -597,7 +602,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, GetRegistration_EarlyContextDeletion) { |
ServiceWorkerMsg_ServiceWorkerGetRegistrationError::ID); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, GetRegistrations_SecureOrigin) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, GetRegistrations_SecureOrigin) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
CreateServiceWorkerProviderHost(kProviderId)); |
@@ -607,7 +612,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, GetRegistrations_SecureOrigin) { |
GetRegistrations(kProviderId, ServiceWorkerMsg_DidGetRegistrations::ID); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, |
+TEST_P(ServiceWorkerDispatcherHostTestP, |
GetRegistrations_NonSecureOriginShouldFail) { |
const int64_t kProviderId = 99; // Dummy value |
std::unique_ptr<ServiceWorkerProviderHost> host( |
@@ -619,7 +624,8 @@ TEST_F(ServiceWorkerDispatcherHostTest, |
EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, GetRegistrations_EarlyContextDeletion) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, |
+ GetRegistrations_EarlyContextDeletion) { |
helper_->ShutdownContext(); |
// Let the shutdown reach the simulated IO thread. |
@@ -628,7 +634,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, GetRegistrations_EarlyContextDeletion) { |
GetRegistrations(-1, ServiceWorkerMsg_ServiceWorkerGetRegistrationsError::ID); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, CleanupOnRendererCrash) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, CleanupOnRendererCrash) { |
GURL pattern = GURL("http://www.example.com/"); |
GURL script_url = GURL("http://www.example.com/service_worker.js"); |
int process_id = helper_->mock_render_process_id(); |
@@ -673,7 +679,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, CleanupOnRendererCrash) { |
EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, DispatchExtendableMessageEvent) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, DispatchExtendableMessageEvent) { |
GURL pattern = GURL("http://www.example.com/"); |
GURL script_url = GURL("http://www.example.com/service_worker.js"); |
@@ -713,7 +719,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, DispatchExtendableMessageEvent) { |
EXPECT_EQ(ref_count + 1, sender_worker_handle->ref_count()); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, DispatchExtendableMessageEvent_Fail) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, DispatchExtendableMessageEvent_Fail) { |
GURL pattern = GURL("http://www.example.com/"); |
GURL script_url = GURL("http://www.example.com/service_worker.js"); |
@@ -754,7 +760,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, DispatchExtendableMessageEvent_Fail) { |
EXPECT_EQ(ref_count, sender_worker_handle->ref_count()); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, OnSetHostedVersionId) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, OnSetHostedVersionId) { |
GURL pattern = GURL("http://www.example.com/"); |
GURL script_url = GURL("http://www.example.com/service_worker.js"); |
@@ -782,7 +788,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, OnSetHostedVersionId) { |
EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, OnSetHostedVersionId_DetachedWorker) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, OnSetHostedVersionId_DetachedWorker) { |
GURL pattern = GURL("http://www.example.com/"); |
GURL script_url = GURL("http://www.example.com/service_worker.js"); |
@@ -810,7 +816,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, OnSetHostedVersionId_DetachedWorker) { |
EXPECT_EQ(0, dispatcher_host_->bad_messages_received_count_); |
} |
-TEST_F(ServiceWorkerDispatcherHostTest, ReceivedTimedOutRequestResponse) { |
+TEST_P(ServiceWorkerDispatcherHostTestP, ReceivedTimedOutRequestResponse) { |
GURL pattern = GURL("https://www.example.com/"); |
GURL script_url = GURL("https://www.example.com/service_worker.js"); |
@@ -837,4 +843,8 @@ TEST_F(ServiceWorkerDispatcherHostTest, ReceivedTimedOutRequestResponse) { |
EXPECT_EQ(0, dispatcher_host_->bad_messages_received_count_); |
} |
+INSTANTIATE_TEST_CASE_P(ServiceWorkerDispatcherHostTest, |
+ ServiceWorkerDispatcherHostTestP, |
+ testing::Bool()); |
+ |
} // namespace content |