| 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 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 AssociateRendererProcessToPattern(pattern); | 591 AssociateRendererProcessToPattern(pattern); |
| 592 } | 592 } |
| 593 | 593 |
| 594 void TimeoutWorkerOnIOThread() { | 594 void TimeoutWorkerOnIOThread() { |
| 595 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 595 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 596 version_->SimulatePingTimeoutForTesting(); | 596 version_->SimulatePingTimeoutForTesting(); |
| 597 } | 597 } |
| 598 | 598 |
| 599 void AddControlleeOnIOThread() { | 599 void AddControlleeOnIOThread() { |
| 600 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 600 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 601 std::unique_ptr<ServiceWorkerProviderHost> host( | 601 std::unique_ptr<ServiceWorkerProviderHost> host = |
| 602 new ServiceWorkerProviderHost( | 602 ServiceWorkerProviderHost::CreateForTesting( |
| 603 33 /* dummy render process id */, | 603 33 /* dummy render process id */, 1 /* dummy provider_id */, |
| 604 MSG_ROUTING_NONE /* render_frame_id */, 1 /* dummy provider_id */, | |
| 605 SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 604 SERVICE_WORKER_PROVIDER_FOR_WINDOW, |
| 606 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | 605 wrapper()->context()->AsWeakPtr()); |
| 607 wrapper()->context()->AsWeakPtr(), NULL)); | 606 host->set_parent_frame_secure(true); |
| 608 host->SetDocumentUrl( | 607 host->SetDocumentUrl( |
| 609 embedded_test_server()->GetURL("/service_worker/host")); | 608 embedded_test_server()->GetURL("/service_worker/host")); |
| 610 host->AssociateRegistration(registration_.get(), | 609 host->AssociateRegistration(registration_.get(), |
| 611 false /* notify_controllerchange */); | 610 false /* notify_controllerchange */); |
| 612 wrapper()->context()->AddProviderHost(std::move(host)); | 611 wrapper()->context()->AddProviderHost(std::move(host)); |
| 613 } | 612 } |
| 614 | 613 |
| 615 void AddWaitingWorkerOnIOThread(const std::string& worker_url) { | 614 void AddWaitingWorkerOnIOThread(const std::string& worker_url) { |
| 616 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 615 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 617 scoped_refptr<ServiceWorkerVersion> waiting_version( | 616 scoped_refptr<ServiceWorkerVersion> waiting_version( |
| (...skipping 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2936 // effect in CanSuspendRenderer(). | 2935 // effect in CanSuspendRenderer(). |
| 2937 shell()->web_contents()->WasHidden(); | 2936 shell()->web_contents()->WasHidden(); |
| 2938 EXPECT_TRUE(rph->IsProcessBackgrounded()); | 2937 EXPECT_TRUE(rph->IsProcessBackgrounded()); |
| 2939 | 2938 |
| 2940 // The process which has service worker thread shouldn't be suspended. | 2939 // The process which has service worker thread shouldn't be suspended. |
| 2941 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); | 2940 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); |
| 2942 } | 2941 } |
| 2943 #endif | 2942 #endif |
| 2944 | 2943 |
| 2945 } // namespace content | 2944 } // namespace content |
| OLD | NEW |