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

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

Issue 2579233002: Merge MemoryCoordinator and MemoryCoordinatorImpl into one class (Closed)
Patch Set: addressed comments Created 3 years, 12 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 13 matching lines...) Expand all
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/test/scoped_feature_list.h" 25 #include "base/test/scoped_feature_list.h"
26 #include "base/threading/thread_task_runner_handle.h" 26 #include "base/threading/thread_task_runner_handle.h"
27 #include "base/time/time.h" 27 #include "base/time/time.h"
28 #include "build/build_config.h" 28 #include "build/build_config.h"
29 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 29 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
30 #include "content/browser/cache_storage/cache_storage_cache.h" 30 #include "content/browser/cache_storage/cache_storage_cache.h"
31 #include "content/browser/cache_storage/cache_storage_cache_handle.h" 31 #include "content/browser/cache_storage/cache_storage_cache_handle.h"
32 #include "content/browser/cache_storage/cache_storage_context_impl.h" 32 #include "content/browser/cache_storage/cache_storage_context_impl.h"
33 #include "content/browser/cache_storage/cache_storage_manager.h" 33 #include "content/browser/cache_storage/cache_storage_manager.h"
34 #include "content/browser/memory/memory_coordinator.h" 34 #include "content/browser/memory/memory_coordinator_impl.h"
35 #include "content/browser/service_worker/embedded_worker_instance.h" 35 #include "content/browser/service_worker/embedded_worker_instance.h"
36 #include "content/browser/service_worker/embedded_worker_registry.h" 36 #include "content/browser/service_worker/embedded_worker_registry.h"
37 #include "content/browser/service_worker/embedded_worker_status.h" 37 #include "content/browser/service_worker/embedded_worker_status.h"
38 #include "content/browser/service_worker/service_worker_context_core.h" 38 #include "content/browser/service_worker/service_worker_context_core.h"
39 #include "content/browser/service_worker/service_worker_context_observer.h" 39 #include "content/browser/service_worker/service_worker_context_observer.h"
40 #include "content/browser/service_worker/service_worker_context_wrapper.h" 40 #include "content/browser/service_worker/service_worker_context_wrapper.h"
41 #include "content/browser/service_worker/service_worker_fetch_dispatcher.h" 41 #include "content/browser/service_worker/service_worker_fetch_dispatcher.h"
42 #include "content/browser/service_worker/service_worker_registration.h" 42 #include "content/browser/service_worker/service_worker_registration.h"
43 #include "content/browser/service_worker/service_worker_test_utils.h" 43 #include "content/browser/service_worker/service_worker_test_utils.h"
44 #include "content/browser/service_worker/service_worker_version.h" 44 #include "content/browser/service_worker/service_worker_version.h"
(...skipping 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after
2985 // MemoryCoordinatorWithServiceWorkerTest checks if a process won't be 2985 // MemoryCoordinatorWithServiceWorkerTest checks if a process won't be
2986 // suspended when it has one or more shared workers or service workers. 2986 // suspended when it has one or more shared workers or service workers.
2987 // TODO(shimazu): Enable these tests on macos when MemoryMonitorMac is 2987 // TODO(shimazu): Enable these tests on macos when MemoryMonitorMac is
2988 // implemented. 2988 // implemented.
2989 #if !defined(OS_MACOSX) 2989 #if !defined(OS_MACOSX)
2990 IN_PROC_BROWSER_TEST_P(MemoryCoordinatorWithServiceWorkerTest, 2990 IN_PROC_BROWSER_TEST_P(MemoryCoordinatorWithServiceWorkerTest,
2991 CannotSuspendRendererWithServiceWorker) { 2991 CannotSuspendRendererWithServiceWorker) {
2992 StartServerAndNavigateToSetup(); 2992 StartServerAndNavigateToSetup();
2993 ActivateTestHelper("/service_worker/fetch_event.js", SERVICE_WORKER_OK); 2993 ActivateTestHelper("/service_worker/fetch_event.js", SERVICE_WORKER_OK);
2994 2994
2995 MemoryCoordinator* memory_coordinator = MemoryCoordinator::GetInstance(); 2995 MemoryCoordinatorImpl* memory_coordinator =
2996 MemoryCoordinatorImpl::GetInstance();
2996 memory_coordinator->SetDelegateForTesting( 2997 memory_coordinator->SetDelegateForTesting(
2997 base::MakeUnique<TestMemoryCoordinatorDelegate>()); 2998 base::MakeUnique<TestMemoryCoordinatorDelegate>());
2998 2999
2999 // Ensure only one process host exists. 3000 // Ensure only one process host exists.
3000 ASSERT_EQ(1, CountRenderProcessHosts()); 3001 ASSERT_EQ(1, CountRenderProcessHosts());
3001 ASSERT_EQ(1u, memory_coordinator->children().size()); 3002 ASSERT_EQ(1u, memory_coordinator->children().size());
3002 3003
3003 // Check the number of workers. 3004 // Check the number of workers.
3004 int render_process_id = memory_coordinator->children().begin()->first; 3005 int render_process_id = memory_coordinator->children().begin()->first;
3005 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id); 3006 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 ServiceWorkerV8CacheStrategiesNormalTest, 3044 ServiceWorkerV8CacheStrategiesNormalTest,
3044 ::testing::Values(true, false)); 3045 ::testing::Values(true, false));
3045 INSTANTIATE_TEST_CASE_P(ServiceWorkerBrowserTest, 3046 INSTANTIATE_TEST_CASE_P(ServiceWorkerBrowserTest,
3046 ServiceWorkerV8CacheStrategiesAggressiveTest, 3047 ServiceWorkerV8CacheStrategiesAggressiveTest,
3047 ::testing::Values(true, false)); 3048 ::testing::Values(true, false));
3048 INSTANTIATE_TEST_CASE_P(ServiceWorkerBrowserTest, 3049 INSTANTIATE_TEST_CASE_P(ServiceWorkerBrowserTest,
3049 ServiceWorkerDisableWebSecurityTest, 3050 ServiceWorkerDisableWebSecurityTest,
3050 ::testing::Values(true, false)); 3051 ::testing::Values(true, false));
3051 3052
3052 } // namespace content 3053 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/public/test/memory_coordinator_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698