OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 virtual void RemoveRoute(int32 routing_id) OVERRIDE; | 40 virtual void RemoveRoute(int32 routing_id) OVERRIDE; |
41 virtual void AddObserver(RenderProcessHostObserver* observer) OVERRIDE; | 41 virtual void AddObserver(RenderProcessHostObserver* observer) OVERRIDE; |
42 virtual void RemoveObserver(RenderProcessHostObserver* observer) OVERRIDE; | 42 virtual void RemoveObserver(RenderProcessHostObserver* observer) OVERRIDE; |
43 virtual bool WaitForBackingStoreMsg(int render_widget_id, | 43 virtual bool WaitForBackingStoreMsg(int render_widget_id, |
44 const base::TimeDelta& max_delay, | 44 const base::TimeDelta& max_delay, |
45 IPC::Message* msg) OVERRIDE; | 45 IPC::Message* msg) OVERRIDE; |
46 virtual void ReceivedBadMessage() OVERRIDE; | 46 virtual void ReceivedBadMessage() OVERRIDE; |
47 virtual void WidgetRestored() OVERRIDE; | 47 virtual void WidgetRestored() OVERRIDE; |
48 virtual void WidgetHidden() OVERRIDE; | 48 virtual void WidgetHidden() OVERRIDE; |
49 virtual int VisibleWidgetCount() const OVERRIDE; | 49 virtual int VisibleWidgetCount() const OVERRIDE; |
50 virtual bool IsGuest() const OVERRIDE; | 50 virtual bool IsIsolatedGuest() const OVERRIDE; |
51 virtual StoragePartition* GetStoragePartition() const OVERRIDE; | 51 virtual StoragePartition* GetStoragePartition() const OVERRIDE; |
52 virtual void AddWord(const base::string16& word); | 52 virtual void AddWord(const base::string16& word); |
53 virtual bool FastShutdownIfPossible() OVERRIDE; | 53 virtual bool FastShutdownIfPossible() OVERRIDE; |
54 virtual bool FastShutdownStarted() const OVERRIDE; | 54 virtual bool FastShutdownStarted() const OVERRIDE; |
55 virtual void DumpHandles() OVERRIDE; | 55 virtual void DumpHandles() OVERRIDE; |
56 virtual base::ProcessHandle GetHandle() const OVERRIDE; | 56 virtual base::ProcessHandle GetHandle() const OVERRIDE; |
57 virtual int GetID() const OVERRIDE; | 57 virtual int GetID() const OVERRIDE; |
58 virtual bool HasConnection() const OVERRIDE; | 58 virtual bool HasConnection() const OVERRIDE; |
59 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; | 59 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; |
60 virtual bool IgnoreInputEvents() const OVERRIDE; | 60 virtual bool IgnoreInputEvents() const OVERRIDE; |
(...skipping 29 matching lines...) Expand all Loading... |
90 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 90 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
91 | 91 |
92 // Attaches the factory object so we can remove this object in its destructor | 92 // Attaches the factory object so we can remove this object in its destructor |
93 // and prevent MockRenderProcessHostFacotry from deleting it. | 93 // and prevent MockRenderProcessHostFacotry from deleting it. |
94 void SetFactory(const MockRenderProcessHostFactory* factory) { | 94 void SetFactory(const MockRenderProcessHostFactory* factory) { |
95 factory_ = factory; | 95 factory_ = factory; |
96 } | 96 } |
97 | 97 |
98 int GetActiveViewCount(); | 98 int GetActiveViewCount(); |
99 | 99 |
100 void SetIsGuest(bool is_guest) { | |
101 is_guest_ = is_guest; | |
102 } | |
103 | |
104 private: | 100 private: |
105 // Stores IPC messages that would have been sent to the renderer. | 101 // Stores IPC messages that would have been sent to the renderer. |
106 IPC::TestSink sink_; | 102 IPC::TestSink sink_; |
107 int bad_msg_count_; | 103 int bad_msg_count_; |
108 const MockRenderProcessHostFactory* factory_; | 104 const MockRenderProcessHostFactory* factory_; |
109 int id_; | 105 int id_; |
110 BrowserContext* browser_context_; | 106 BrowserContext* browser_context_; |
111 ObserverList<RenderProcessHostObserver> observers_; | 107 ObserverList<RenderProcessHostObserver> observers_; |
112 | 108 |
113 IDMap<RenderWidgetHost> render_widget_hosts_; | 109 IDMap<RenderWidgetHost> render_widget_hosts_; |
114 int prev_routing_id_; | 110 int prev_routing_id_; |
115 IDMap<IPC::Listener> listeners_; | 111 IDMap<IPC::Listener> listeners_; |
116 bool fast_shutdown_started_; | 112 bool fast_shutdown_started_; |
117 bool deletion_callback_called_; | 113 bool deletion_callback_called_; |
118 bool is_guest_; | |
119 | 114 |
120 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); | 115 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); |
121 }; | 116 }; |
122 | 117 |
123 class MockRenderProcessHostFactory : public RenderProcessHostFactory { | 118 class MockRenderProcessHostFactory : public RenderProcessHostFactory { |
124 public: | 119 public: |
125 MockRenderProcessHostFactory(); | 120 MockRenderProcessHostFactory(); |
126 virtual ~MockRenderProcessHostFactory(); | 121 virtual ~MockRenderProcessHostFactory(); |
127 | 122 |
128 virtual RenderProcessHost* CreateRenderProcessHost( | 123 virtual RenderProcessHost* CreateRenderProcessHost( |
(...skipping 10 matching lines...) Expand all Loading... |
139 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 134 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
140 // the destructor and prevent them from being leaked. | 135 // the destructor and prevent them from being leaked. |
141 mutable ScopedVector<MockRenderProcessHost> processes_; | 136 mutable ScopedVector<MockRenderProcessHost> processes_; |
142 | 137 |
143 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 138 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
144 }; | 139 }; |
145 | 140 |
146 } // namespace content | 141 } // namespace content |
147 | 142 |
148 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 143 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
OLD | NEW |