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

Side by Side Diff: content/browser/renderer_host/mock_render_process_host.h

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slight tweaking for comments Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MOCK_RENDER_PROCESS_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MOCK_RENDER_PROCESS_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MOCK_RENDER_PROCESS_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MOCK_RENDER_PROCESS_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "content/browser/renderer_host/render_process_host.h" 11 #include "content/browser/renderer_host/render_process_host.h"
12 #include "ipc/ipc_test_sink.h" 12 #include "ipc/ipc_test_sink.h"
13 13
14 class MockRenderProcessHostFactory; 14 class MockRenderProcessHostFactory;
15 class TransportDIB; 15 class TransportDIB;
16 16
17 namespace net { 17 namespace net {
18 class URLRequestContextGetter; 18 class URLRequestContextGetter;
19 } 19 }
20 20
21 // A mock render process host that has no corresponding renderer process. All 21 // A mock render process host that has no corresponding renderer process. All
22 // IPC messages are sent into the message sink for inspection by tests. 22 // IPC messages are sent into the message sink for inspection by tests.
23 class MockRenderProcessHost : public RenderProcessHost { 23 class MockRenderProcessHost : public RenderProcessHost {
24 public: 24 public:
25 explicit MockRenderProcessHost(Profile* profile); 25 explicit MockRenderProcessHost(content::BrowserContext* browser_context);
26 virtual ~MockRenderProcessHost(); 26 virtual ~MockRenderProcessHost();
27 27
28 // Provides access to all IPC messages that would have been sent to the 28 // Provides access to all IPC messages that would have been sent to the
29 // renderer via this RenderProcessHost. 29 // renderer via this RenderProcessHost.
30 IPC::TestSink& sink() { return sink_; } 30 IPC::TestSink& sink() { return sink_; }
31 31
32 // Provides tests access to the max page ID currently used for this process. 32 // Provides tests access to the max page ID currently used for this process.
33 int max_page_id() const { return max_page_id_; } 33 int max_page_id() const { return max_page_id_; }
34 34
35 // Provides test access to how many times a bad message has been received. 35 // Provides test access to how many times a bad message has been received.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 const MockRenderProcessHostFactory* factory_; 77 const MockRenderProcessHostFactory* factory_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); 79 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost);
80 }; 80 };
81 81
82 class MockRenderProcessHostFactory : public RenderProcessHostFactory { 82 class MockRenderProcessHostFactory : public RenderProcessHostFactory {
83 public: 83 public:
84 MockRenderProcessHostFactory(); 84 MockRenderProcessHostFactory();
85 virtual ~MockRenderProcessHostFactory(); 85 virtual ~MockRenderProcessHostFactory();
86 86
87 virtual RenderProcessHost* CreateRenderProcessHost(Profile* profile) const; 87 virtual RenderProcessHost* CreateRenderProcessHost(
88 content::BrowserContext* browser_context) const OVERRIDE;
88 89
89 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list 90 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list
90 // without deleting it. When a test deletes a MockRenderProcessHost, we need 91 // without deleting it. When a test deletes a MockRenderProcessHost, we need
91 // to remove it from |processes_| to prevent it from being deleted twice. 92 // to remove it from |processes_| to prevent it from being deleted twice.
92 void Remove(MockRenderProcessHost* host) const; 93 void Remove(MockRenderProcessHost* host) const;
93 94
94 private: 95 private:
95 // A list of MockRenderProcessHosts created by this object. This list is used 96 // A list of MockRenderProcessHosts created by this object. This list is used
96 // for deleting all MockRenderProcessHosts that have not deleted by a test in 97 // for deleting all MockRenderProcessHosts that have not deleted by a test in
97 // the destructor and prevent them from being leaked. 98 // the destructor and prevent them from being leaked.
98 mutable ScopedVector<MockRenderProcessHost> processes_; 99 mutable ScopedVector<MockRenderProcessHost> processes_;
99 100
100 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); 101 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory);
101 }; 102 };
102 103
103 #endif // CONTENT_BROWSER_RENDERER_HOST_MOCK_RENDER_PROCESS_HOST_H_ 104 #endif // CONTENT_BROWSER_RENDERER_HOST_MOCK_RENDER_PROCESS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698