Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: content/browser/service_worker/service_worker_browsertest.cc

Issue 2638313002: Manage ServiceWorkerDispatcherHost in ServiceWorkerContextCore (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 CreateProviderHostForWindow(33 /* dummy render process id */,
603 33 /* dummy render process id */, 603 1 /* dummy provider_id */,
604 MSG_ROUTING_NONE /* render_frame_id */, 1 /* dummy provider_id */, 604 true /* is_parent_frame_secure */,
605 SERVICE_WORKER_PROVIDER_FOR_WINDOW, 605 wrapper()->context()->AsWeakPtr());
606 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
607 wrapper()->context()->AsWeakPtr(), NULL));
608 host->SetDocumentUrl( 606 host->SetDocumentUrl(
609 embedded_test_server()->GetURL("/service_worker/host")); 607 embedded_test_server()->GetURL("/service_worker/host"));
610 host->AssociateRegistration(registration_.get(), 608 host->AssociateRegistration(registration_.get(),
611 false /* notify_controllerchange */); 609 false /* notify_controllerchange */);
612 wrapper()->context()->AddProviderHost(std::move(host)); 610 wrapper()->context()->AddProviderHost(std::move(host));
613 } 611 }
614 612
615 void AddWaitingWorkerOnIOThread(const std::string& worker_url) { 613 void AddWaitingWorkerOnIOThread(const std::string& worker_url) {
616 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); 614 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
617 scoped_refptr<ServiceWorkerVersion> waiting_version( 615 scoped_refptr<ServiceWorkerVersion> waiting_version(
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 // effect in CanSuspendRenderer(). 2936 // effect in CanSuspendRenderer().
2939 shell()->web_contents()->WasHidden(); 2937 shell()->web_contents()->WasHidden();
2940 EXPECT_TRUE(rph->IsProcessBackgrounded()); 2938 EXPECT_TRUE(rph->IsProcessBackgrounded());
2941 2939
2942 // The process which has service worker thread shouldn't be suspended. 2940 // The process which has service worker thread shouldn't be suspended.
2943 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); 2941 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id));
2944 } 2942 }
2945 #endif 2943 #endif
2946 2944
2947 } // namespace content 2945 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698