OLD | NEW |
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 // This file tests that Service Workers (a Content feature) work in the Chromium | 5 // This file tests that Service Workers (a Content feature) work in the Chromium |
6 // embedder. | 6 // embedder. |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 " });" | 267 " });" |
268 " });" | 268 " });" |
269 " });" | 269 " });" |
270 "var reportOnFetch = true;" | 270 "var reportOnFetch = true;" |
271 "var issuedRequests = [];" | 271 "var issuedRequests = [];" |
272 "function reportRequests() {" | 272 "function reportRequests() {" |
273 " var str = '';" | 273 " var str = '';" |
274 " issuedRequests.forEach(function(data) {" | 274 " issuedRequests.forEach(function(data) {" |
275 " str += data + '\\n';" | 275 " str += data + '\\n';" |
276 " });" | 276 " });" |
277 " window.domAutomationController.setAutomationId(0);" | |
278 " window.domAutomationController.send(str);" | 277 " window.domAutomationController.send(str);" |
279 "}" | 278 "}" |
280 "navigator.serviceWorker.addEventListener(" | 279 "navigator.serviceWorker.addEventListener(" |
281 " 'message'," | 280 " 'message'," |
282 " function(event) {" | 281 " function(event) {" |
283 " issuedRequests.push(event.data);" | 282 " issuedRequests.push(event.data);" |
284 " if (reportOnFetch) {" | 283 " if (reportOnFetch) {" |
285 " reportRequests();" | 284 " reportRequests();" |
286 " }" | 285 " }" |
287 " }, false);" | 286 " }, false);" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 NavigateToPageAndWaitForReadyTitle("/test.html"); | 695 NavigateToPageAndWaitForReadyTitle("/test.html"); |
697 GetServiceWorkerContext()->StopAllServiceWorkersForOrigin( | 696 GetServiceWorkerContext()->StopAllServiceWorkersForOrigin( |
698 embedded_test_server()->base_url()); | 697 embedded_test_server()->base_url()); |
699 RunNavigationHintTest( | 698 RunNavigationHintTest( |
700 "/scope/", | 699 "/scope/", |
701 content::StartServiceWorkerForNavigationHintResult::NO_FETCH_HANDLER, | 700 content::StartServiceWorkerForNavigationHintResult::NO_FETCH_HANDLER, |
702 false); | 701 false); |
703 } | 702 } |
704 | 703 |
705 } // namespace | 704 } // namespace |
OLD | NEW |