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

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

Issue 1303773002: Give the main frame a RenderWidget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge conflicts Created 5 years, 2 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
OLDNEW
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"
11 #include "cc/test/test_shared_bitmap_manager.h" 11 #include "cc/test/test_shared_bitmap_manager.h"
12 #include "content/public/renderer/render_thread.h" 12 #include "content/public/renderer/render_thread.h"
13 #include "ipc/ipc_test_sink.h" 13 #include "ipc/ipc_test_sink.h"
14 #include "ipc/message_filter.h" 14 #include "ipc/message_filter.h"
15 #include "third_party/WebKit/public/web/WebPopupType.h" 15 #include "third_party/WebKit/public/web/WebPopupType.h"
16 16
17 struct ViewHostMsg_CreateWindow_Params; 17 struct ViewHostMsg_CreateWindow_Params;
18 struct ViewHostMsg_CreateWindow_Reply;
18 19
19 namespace IPC { 20 namespace IPC {
20 class MessageFilter; 21 class MessageFilter;
21 class MessageReplyDeserializer; 22 class MessageReplyDeserializer;
22 } 23 }
23 24
24 namespace blink { 25 namespace blink {
25 enum class WebSandboxFlags; 26 enum class WebSandboxFlags;
26 enum class WebTreeScopeType; 27 enum class WebTreeScopeType;
27 } 28 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 87 }
87 88
88 int32 opener_id() const { 89 int32 opener_id() const {
89 return opener_id_; 90 return opener_id_;
90 } 91 }
91 92
92 void set_new_window_routing_id(int32 id) { 93 void set_new_window_routing_id(int32 id) {
93 new_window_routing_id_ = id; 94 new_window_routing_id_ = id;
94 } 95 }
95 96
97 void set_new_window_main_frame_widget_routing_id(int32_t id) {
98 new_window_main_frame_widget_routing_id_ = id;
99 }
100
96 void set_new_frame_routing_id(int32 id) { 101 void set_new_frame_routing_id(int32 id) {
97 new_frame_routing_id_ = id; 102 new_frame_routing_id_ = id;
98 } 103 }
99 104
100 // Simulates the Widget receiving a close message. This should result 105 // Simulates the Widget receiving a close message. This should result
101 // on releasing the internal reference counts and destroying the internal 106 // on releasing the internal reference counts and destroying the internal
102 // state. 107 // state.
103 void SendCloseMessage(); 108 void SendCloseMessage();
104 109
105 // Dispatches control messages to observers. 110 // Dispatches control messages to observers.
106 bool OnControlMessageReceived(const IPC::Message& msg); 111 bool OnControlMessageReceived(const IPC::Message& msg);
107 112
108 base::ObserverList<RenderProcessObserver>& observers() { return observers_; } 113 base::ObserverList<RenderProcessObserver>& observers() { return observers_; }
109 114
110 protected: 115 protected:
111 // This function operates as a regular IPC listener. Subclasses 116 // This function operates as a regular IPC listener. Subclasses
112 // overriding this should first delegate to this implementation. 117 // overriding this should first delegate to this implementation.
113 virtual bool OnMessageReceived(const IPC::Message& msg); 118 virtual bool OnMessageReceived(const IPC::Message& msg);
114 119
115 // The Widget expects to be returned valid route_id. 120 // The Widget expects to be returned valid route_id.
116 void OnCreateWidget(int opener_id, 121 void OnCreateWidget(int opener_id,
117 blink::WebPopupType popup_type, 122 blink::WebPopupType popup_type,
118 int* route_id); 123 int* route_id);
119 124
120 // The View expects to be returned a valid route_id different from its own. 125 // The View expects to be returned a valid |reply.route_id| different from its
121 // We do not keep track of the newly created widget in MockRenderThread, 126 // own. We do not keep track of the newly created widget in MockRenderThread,
122 // so it must be cleaned up on its own. 127 // so it must be cleaned up on its own.
123 void OnCreateWindow( 128 void OnCreateWindow(const ViewHostMsg_CreateWindow_Params& params,
124 const ViewHostMsg_CreateWindow_Params& params, 129 ViewHostMsg_CreateWindow_Reply* reply);
125 int* route_id,
126 int* main_frame_route_id,
127 int64* cloned_session_storage_namespace_id);
128 130
129 // The Frame expects to be returned a valid route_id different from its own. 131 // The Frame expects to be returned a valid route_id different from its own.
130 void OnCreateChildFrame(int new_frame_routing_id, 132 void OnCreateChildFrame(int new_frame_routing_id,
131 blink::WebTreeScopeType scope, 133 blink::WebTreeScopeType scope,
132 const std::string& frame_name, 134 const std::string& frame_name,
133 blink::WebSandboxFlags sandbox_flags, 135 blink::WebSandboxFlags sandbox_flags,
134 int* new_render_frame_id); 136 int* new_render_frame_id);
135 137
136 #if defined(OS_WIN) 138 #if defined(OS_WIN)
137 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, 139 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle,
138 base::SharedMemoryHandle* browser_handle); 140 base::SharedMemoryHandle* browser_handle);
139 #endif 141 #endif
140 142
141 IPC::TestSink sink_; 143 IPC::TestSink sink_;
142 144
143 // Routing id what will be assigned to the Widget. 145 // Routing id what will be assigned to the Widget.
144 int32 routing_id_; 146 int32 routing_id_;
145 147
146 // Opener id reported by the Widget. 148 // Opener id reported by the Widget.
147 int32 opener_id_; 149 int32 opener_id_;
148 150
149 // Routing id that will be assigned to a CreateWindow Widget. 151 // Routing id that will be assigned to a CreateWindow Widget.
150 int32 new_window_routing_id_; 152 int32 new_window_routing_id_;
151 int32 new_window_main_frame_routing_id_; 153 int32 new_window_main_frame_routing_id_;
154 int32_t new_window_main_frame_widget_routing_id_;
152 int32 new_frame_routing_id_; 155 int32 new_frame_routing_id_;
153 156
154 // The last known good deserializer for sync messages. 157 // The last known good deserializer for sync messages.
155 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; 158 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_;
156 159
157 // A list of message filters added to this thread. 160 // A list of message filters added to this thread.
158 std::vector<scoped_refptr<IPC::MessageFilter> > filters_; 161 std::vector<scoped_refptr<IPC::MessageFilter> > filters_;
159 162
160 // Observers to notify. 163 // Observers to notify.
161 base::ObserverList<RenderProcessObserver> observers_; 164 base::ObserverList<RenderProcessObserver> observers_;
162 165
163 cc::TestSharedBitmapManager shared_bitmap_manager_; 166 cc::TestSharedBitmapManager shared_bitmap_manager_;
164 }; 167 };
165 168
166 } // namespace content 169 } // namespace content
167 170
168 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ 171 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698