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

Side by Side Diff: content/test/mock_render_thread.h

Issue 8801001: Get rid of view_messages.h dependency in extension_messages_browsertest.cc by adding a method to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/chrome_render_view_test.cc ('k') | content/test/mock_render_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_TEST_MOCK_RENDER_THREAD_H_ 5 #ifndef CONTENT_TEST_MOCK_RENDER_THREAD_H_
6 #define CONTENT_TEST_MOCK_RENDER_THREAD_H_ 6 #define CONTENT_TEST_MOCK_RENDER_THREAD_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/shared_memory.h" 9 #include "base/shared_memory.h"
10 #include "base/string16.h"
10 #include "content/public/renderer/render_thread.h" 11 #include "content/public/renderer/render_thread.h"
11 #include "ipc/ipc_test_sink.h" 12 #include "ipc/ipc_test_sink.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h"
13 14
14 namespace IPC { 15 namespace IPC {
15 class MessageReplyDeserializer; 16 class MessageReplyDeserializer;
16 } 17 }
17 18
18 namespace content { 19 namespace content {
19 20
20 // This class is a very simple mock of RenderThread. It simulates an IPC channel 21 // This class is a very simple mock of RenderThread. It simulates an IPC channel
21 // which supports only two messages: 22 // which supports only two messages:
22 // ViewHostMsg_CreateWidget : sync message sent by the Widget. 23 // ViewHostMsg_CreateWidget : sync message sent by the Widget.
23 // ViewMsg_Close : async, send to the Widget. 24 // ViewMsg_Close : async, send to the Widget.
24 class MockRenderThread : public content::RenderThread { 25 class MockRenderThread : public content::RenderThread {
25 public: 26 public:
26 MockRenderThread(); 27 MockRenderThread();
27 virtual ~MockRenderThread(); 28 virtual ~MockRenderThread();
28 29
29 // Provides access to the messages that have been received by this thread. 30 // Provides access to the messages that have been received by this thread.
30 IPC::TestSink& sink() { return sink_; } 31 IPC::TestSink& sink() { return sink_; }
31 32
33 // Helpers for embedders to know when content IPC messages are received, since
34 // they don't have access to content IPC files.
35 void VerifyRunJavaScriptMessageSend(const string16& expected_alert_message);
36
32 // content::RenderThread implementation: 37 // content::RenderThread implementation:
33 virtual bool Send(IPC::Message* msg) OVERRIDE; 38 virtual bool Send(IPC::Message* msg) OVERRIDE;
34 virtual MessageLoop* GetMessageLoop() OVERRIDE; 39 virtual MessageLoop* GetMessageLoop() OVERRIDE;
35 virtual IPC::SyncChannel* GetChannel() OVERRIDE; 40 virtual IPC::SyncChannel* GetChannel() OVERRIDE;
36 virtual std::string GetLocale() OVERRIDE; 41 virtual std::string GetLocale() OVERRIDE;
37 virtual void AddRoute(int32 routing_id, 42 virtual void AddRoute(int32 routing_id,
38 IPC::Channel::Listener* listener) OVERRIDE; 43 IPC::Channel::Listener* listener) OVERRIDE;
39 virtual void RemoveRoute(int32 routing_id) OVERRIDE; 44 virtual void RemoveRoute(int32 routing_id) OVERRIDE;
40 virtual int GenerateRoutingID() OVERRIDE; 45 virtual int GenerateRoutingID() OVERRIDE;
41 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) OVERRIDE; 46 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) OVERRIDE;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // adds a new route. 118 // adds a new route.
114 IPC::Channel::Listener* widget_; 119 IPC::Channel::Listener* widget_;
115 120
116 // The last known good deserializer for sync messages. 121 // The last known good deserializer for sync messages.
117 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; 122 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_;
118 }; 123 };
119 124
120 } // namespace content 125 } // namespace content
121 126
122 #endif // CONTENT_TEST_MOCK_RENDER_THREAD_H_ 127 #endif // CONTENT_TEST_MOCK_RENDER_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_render_view_test.cc ('k') | content/test/mock_render_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698