Chromium Code Reviews| 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 462d093bae277e4b025794237f480e329178cbfa..23df8fa9bf94e003e8248f0eaddf0b61bad40dce 100644 |
| --- a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc |
| +++ b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc |
| @@ -334,6 +334,38 @@ TEST_F(ServiceWorkerDispatcherHostTest, |
| EXPECT_EQ(3, dispatcher_host_->bad_messages_received_count_); |
| } |
| +TEST_F(ServiceWorkerDispatcherHostTest, RegisterWithBadCharactersShouldFail) { |
|
nhiroki
2015/08/10 08:15:51
"Register_BadCharactersShouldFail" seems more cons
nhiroki
2015/08/10 08:15:51
Can you move this test to line 313 because this is
|
| + const int64 kProviderId = 99; // Dummy value |
| + scoped_ptr<ServiceWorkerProviderHost> host( |
| + CreateServiceWorkerProviderHost(kProviderId)); |
| + host->SetDocumentUrl(GURL("https://www.example.com/")); |
| + context()->AddProviderHost(host.Pass()); |
| + |
| + SendRegister(kProviderId, GURL("https://www.example.com/%2f"), |
| + GURL("https://www.example.com/")); |
| + EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); |
| + |
| + SendRegister(kProviderId, GURL("https://www.example.com/%2F"), |
| + GURL("https://www.example.com/")); |
| + EXPECT_EQ(2, dispatcher_host_->bad_messages_received_count_); |
| + |
| + SendRegister(kProviderId, GURL("https://www.example.com/"), |
| + GURL("https://www.example.com/%2f")); |
| + EXPECT_EQ(3, dispatcher_host_->bad_messages_received_count_); |
| + |
| + SendRegister(kProviderId, GURL("https://www.example.com/%5c"), |
| + GURL("https://www.example.com/")); |
| + EXPECT_EQ(4, dispatcher_host_->bad_messages_received_count_); |
| + |
| + SendRegister(kProviderId, GURL("https://www.example.com/"), |
| + GURL("https://www.example.com/%5c")); |
| + EXPECT_EQ(5, dispatcher_host_->bad_messages_received_count_); |
| + |
| + SendRegister(kProviderId, GURL("https://www.example.com/"), |
| + GURL("https://www.example.com/%5C")); |
| + EXPECT_EQ(6, dispatcher_host_->bad_messages_received_count_); |
| +} |
| + |
| TEST_F(ServiceWorkerDispatcherHostTest, |
| Register_FileSystemScriptOrScopeShouldFail) { |
| const int64 kProviderId = 99; // Dummy value |