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_THREAD_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ |
6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ |
7 | 7 |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // ViewHostMsg_CreateWindow : sync message sent by the Widget. | 26 // ViewHostMsg_CreateWindow : sync message sent by the Widget. |
27 // ViewMsg_Close : async, send to the Widget. | 27 // ViewMsg_Close : async, send to the Widget. |
28 class MockRenderThread : public RenderThread { | 28 class MockRenderThread : public RenderThread { |
29 public: | 29 public: |
30 MockRenderThread(); | 30 MockRenderThread(); |
31 virtual ~MockRenderThread(); | 31 virtual ~MockRenderThread(); |
32 | 32 |
33 // Provides access to the messages that have been received by this thread. | 33 // Provides access to the messages that have been received by this thread. |
34 IPC::TestSink& sink() { return sink_; } | 34 IPC::TestSink& sink() { return sink_; } |
35 | 35 |
36 // Helpers for embedders to know when content IPC messages are received, since | |
37 // they don't have access to content IPC files. | |
38 void VerifyRunJavaScriptMessageSend( | |
39 const base::string16& expected_alert_message); | |
40 | |
41 // RenderThread implementation: | 36 // RenderThread implementation: |
42 virtual bool Send(IPC::Message* msg) OVERRIDE; | 37 virtual bool Send(IPC::Message* msg) OVERRIDE; |
43 virtual base::MessageLoop* GetMessageLoop() OVERRIDE; | 38 virtual base::MessageLoop* GetMessageLoop() OVERRIDE; |
44 virtual IPC::SyncChannel* GetChannel() OVERRIDE; | 39 virtual IPC::SyncChannel* GetChannel() OVERRIDE; |
45 virtual std::string GetLocale() OVERRIDE; | 40 virtual std::string GetLocale() OVERRIDE; |
46 virtual IPC::SyncMessageFilter* GetSyncMessageFilter() OVERRIDE; | 41 virtual IPC::SyncMessageFilter* GetSyncMessageFilter() OVERRIDE; |
47 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() | 42 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() |
48 OVERRIDE; | 43 OVERRIDE; |
49 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) OVERRIDE; | 44 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) OVERRIDE; |
50 virtual void RemoveRoute(int32 routing_id) OVERRIDE; | 45 virtual void RemoveRoute(int32 routing_id) OVERRIDE; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // A list of message filters added to this thread. | 158 // A list of message filters added to this thread. |
164 std::vector<scoped_refptr<IPC::ChannelProxy::MessageFilter> > filters_; | 159 std::vector<scoped_refptr<IPC::ChannelProxy::MessageFilter> > filters_; |
165 | 160 |
166 // Observers to notify. | 161 // Observers to notify. |
167 ObserverList<RenderProcessObserver> observers_; | 162 ObserverList<RenderProcessObserver> observers_; |
168 }; | 163 }; |
169 | 164 |
170 } // namespace content | 165 } // namespace content |
171 | 166 |
172 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ | 167 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ |
OLD | NEW |