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

Unified Diff: content/browser/memory/memory_coordinator_impl.h

Issue 2594513002: Use MockRenderProcessHost in memory coordinator unittests (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/memory/memory_coordinator_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_coordinator_impl.h
diff --git a/content/browser/memory/memory_coordinator_impl.h b/content/browser/memory/memory_coordinator_impl.h
index b63bc4faac41250c42ffc8517868815ffd53a871..34cf572194833f984428ff7d74502d1895132b40 100644
--- a/content/browser/memory/memory_coordinator_impl.h
+++ b/content/browser/memory/memory_coordinator_impl.h
@@ -28,6 +28,7 @@ class MemoryCoordinatorHandleImpl;
class MemoryCoordinatorImplTest;
class MemoryMonitor;
class MemoryStateUpdater;
+class RenderProcessHost;
struct MemoryCoordinatorSingletonTraits;
// MemoryCoordinatorImpl is an implementation of MemoryCoordinator.
@@ -96,6 +97,16 @@ class CONTENT_EXPORT MemoryCoordinatorImpl : public NotificationObserver,
bool ChangeStateIfNeeded(MemoryState prev_state, MemoryState next_state);
protected:
+ // Returns the RenderProcessHost which is correspond to the given id.
+ // Returns nullptr if there is no corresponding RenderProcessHost.
+ // This is a virtual method so that we can write tests without having
+ // actual RenderProcessHost.
+ virtual RenderProcessHost* GetRenderProcessHost(int render_process_id);
+
+ // Sets a delegate for testing.
+ void SetDelegateForTesting(
+ std::unique_ptr<MemoryCoordinatorDelegate> delegate);
+
// Adds the given ChildMemoryCoordinator as a child of this coordinator.
void AddChildForTesting(int dummy_render_process_id,
mojom::ChildMemoryCoordinatorPtr child);
@@ -148,9 +159,6 @@ class CONTENT_EXPORT MemoryCoordinatorImpl : public NotificationObserver,
MemoryState OverrideGlobalState(MemoryState memroy_state,
const ChildInfo& child);
- void SetDelegateForTesting(
- std::unique_ptr<MemoryCoordinatorDelegate> delegate);
-
// Helper function of CreateHandle and AddChildForTesting.
void CreateChildInfoMapEntry(
int render_process_id,
« no previous file with comments | « no previous file | content/browser/memory/memory_coordinator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698