OLD | NEW |
| 1 |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 4 // found in the LICENSE file. |
4 | 5 |
5 #include "config.h" | 6 #include "config.h" |
6 #include "modules/serviceworkers/ServiceWorkerContainer.h" | 7 #include "modules/serviceworkers/ServiceWorkerContainer.h" |
7 | 8 |
8 #include "bindings/core/v8/Dictionary.h" | 9 #include "bindings/core/v8/Dictionary.h" |
9 #include "bindings/core/v8/ScriptFunction.h" | 10 #include "bindings/core/v8/ScriptFunction.h" |
10 #include "bindings/core/v8/ScriptPromise.h" | 11 #include "bindings/core/v8/ScriptPromise.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 private: | 214 private: |
214 OwnPtr<DummyPageHolder> m_page; | 215 OwnPtr<DummyPageHolder> m_page; |
215 }; | 216 }; |
216 | 217 |
217 TEST_F(ServiceWorkerContainerTest, Register_NonSecureOriginIsRejected) | 218 TEST_F(ServiceWorkerContainerTest, Register_NonSecureOriginIsRejected) |
218 { | 219 { |
219 setPageURL("http://www.example.com/"); | 220 setPageURL("http://www.example.com/"); |
220 testRegisterRejected( | 221 testRegisterRejected( |
221 "http://www.example.com/worker.js", | 222 "http://www.example.com/worker.js", |
222 "http://www.example.com/", | 223 "http://www.example.com/", |
223 ExpectDOMException("NotSupportedError", "Only secure origins are allowed
. http://goo.gl/lq4gCo")); | 224 ExpectDOMException("NotSupportedError", "Only secure origins are allowed
(see: https://goo.gl/Y0ZkNV).")); |
224 } | 225 } |
225 | 226 |
226 TEST_F(ServiceWorkerContainerTest, Register_CrossOriginScriptIsRejected) | 227 TEST_F(ServiceWorkerContainerTest, Register_CrossOriginScriptIsRejected) |
227 { | 228 { |
228 setPageURL("https://www.example.com"); | 229 setPageURL("https://www.example.com"); |
229 testRegisterRejected( | 230 testRegisterRejected( |
230 "https://www.example.com:8080/", // Differs by port | 231 "https://www.example.com:8080/", // Differs by port |
231 "https://www.example.com/", | 232 "https://www.example.com/", |
232 ExpectDOMException("SecurityError", "Failed to register a ServiceWorker:
The origin of the provided scriptURL ('https://www.example.com:8080') does not
match the current origin ('https://www.example.com').")); | 233 ExpectDOMException("SecurityError", "Failed to register a ServiceWorker:
The origin of the provided scriptURL ('https://www.example.com:8080') does not
match the current origin ('https://www.example.com').")); |
233 } | 234 } |
234 | 235 |
235 TEST_F(ServiceWorkerContainerTest, Register_CrossOriginScopeIsRejected) | 236 TEST_F(ServiceWorkerContainerTest, Register_CrossOriginScopeIsRejected) |
236 { | 237 { |
237 setPageURL("https://www.example.com"); | 238 setPageURL("https://www.example.com"); |
238 testRegisterRejected( | 239 testRegisterRejected( |
239 "https://www.example.com", | 240 "https://www.example.com", |
240 "wss://www.example.com/", // Differs by protocol | 241 "wss://www.example.com/", // Differs by protocol |
241 ExpectDOMException("SecurityError", "Failed to register a ServiceWorker:
The origin of the provided scope ('wss://www.example.com') does not match the c
urrent origin ('https://www.example.com').")); | 242 ExpectDOMException("SecurityError", "Failed to register a ServiceWorker:
The origin of the provided scope ('wss://www.example.com') does not match the c
urrent origin ('https://www.example.com').")); |
242 } | 243 } |
243 | 244 |
244 TEST_F(ServiceWorkerContainerTest, GetRegistration_NonSecureOriginIsRejected) | 245 TEST_F(ServiceWorkerContainerTest, GetRegistration_NonSecureOriginIsRejected) |
245 { | 246 { |
246 setPageURL("http://www.example.com/"); | 247 setPageURL("http://www.example.com/"); |
247 testGetRegistrationRejected( | 248 testGetRegistrationRejected( |
248 "http://www.example.com/", | 249 "http://www.example.com/", |
249 ExpectDOMException("NotSupportedError", "Only secure origins are allowed
. http://goo.gl/lq4gCo")); | 250 ExpectDOMException("NotSupportedError", "Only secure origins are allowed
(see: https://goo.gl/Y0ZkNV).")); |
250 } | 251 } |
251 | 252 |
252 TEST_F(ServiceWorkerContainerTest, GetRegistration_CrossOriginURLIsRejected) | 253 TEST_F(ServiceWorkerContainerTest, GetRegistration_CrossOriginURLIsRejected) |
253 { | 254 { |
254 setPageURL("https://www.example.com/"); | 255 setPageURL("https://www.example.com/"); |
255 testGetRegistrationRejected( | 256 testGetRegistrationRejected( |
256 "https://foo.example.com/", // Differs by host | 257 "https://foo.example.com/", // Differs by host |
257 ExpectDOMException("SecurityError", "Failed to get a ServiceWorkerRegist
ration: The origin of the provided documentURL ('https://foo.example.com') does
not match the current origin ('https://www.example.com').")); | 258 ExpectDOMException("SecurityError", "Failed to get a ServiceWorkerRegist
ration: The origin of the provided documentURL ('https://foo.example.com') does
not match the current origin ('https://www.example.com').")); |
258 } | 259 } |
259 | 260 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 380 |
380 setPageVisibilityState(PageVisibilityStateHidden); | 381 setPageVisibilityState(PageVisibilityStateHidden); |
381 setFocused(false); | 382 setFocused(false); |
382 ASSERT_TRUE(container->getClientInfo(&info)); | 383 ASSERT_TRUE(container->getClientInfo(&info)); |
383 EXPECT_EQ(WebPageVisibilityStateHidden, info.pageVisibilityState); | 384 EXPECT_EQ(WebPageVisibilityStateHidden, info.pageVisibilityState); |
384 EXPECT_FALSE(info.isFocused); | 385 EXPECT_FALSE(info.isFocused); |
385 } | 386 } |
386 | 387 |
387 } // namespace | 388 } // namespace |
388 } // namespace blink | 389 } // namespace blink |
OLD | NEW |