OLD | NEW |
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 "base/string16.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 virtual void ReleaseCachedFonts() OVERRIDE; | 71 virtual void ReleaseCachedFonts() OVERRIDE; |
72 #endif | 72 #endif |
73 | 73 |
74 ////////////////////////////////////////////////////////////////////////// | 74 ////////////////////////////////////////////////////////////////////////// |
75 // The following functions are called by the test itself. | 75 // The following functions are called by the test itself. |
76 | 76 |
77 void set_routing_id(int32 id) { | 77 void set_routing_id(int32 id) { |
78 routing_id_ = id; | 78 routing_id_ = id; |
79 } | 79 } |
80 | 80 |
| 81 void set_surface_id(int32 id) { |
| 82 surface_id_ = id; |
| 83 } |
| 84 |
81 int32 opener_id() const { | 85 int32 opener_id() const { |
82 return opener_id_; | 86 return opener_id_; |
83 } | 87 } |
84 | 88 |
85 bool has_widget() const { | 89 bool has_widget() const { |
86 return widget_ ? true : false; | 90 return widget_ ? true : false; |
87 } | 91 } |
88 | 92 |
89 // Simulates the Widget receiving a close message. This should result | 93 // Simulates the Widget receiving a close message. This should result |
90 // on releasing the internal reference counts and destroying the internal | 94 // on releasing the internal reference counts and destroying the internal |
91 // state. | 95 // state. |
92 void SendCloseMessage(); | 96 void SendCloseMessage(); |
93 | 97 |
94 protected: | 98 protected: |
95 // This function operates as a regular IPC listener. Subclasses | 99 // This function operates as a regular IPC listener. Subclasses |
96 // overriding this should first delegate to this implementation. | 100 // overriding this should first delegate to this implementation. |
97 virtual bool OnMessageReceived(const IPC::Message& msg); | 101 virtual bool OnMessageReceived(const IPC::Message& msg); |
98 | 102 |
99 // The Widget expects to be returned valid route_id. | 103 // The Widget expects to be returned valid route_id. |
100 void OnMsgCreateWidget(int opener_id, | 104 void OnMsgCreateWidget(int opener_id, |
101 WebKit::WebPopupType popup_type, | 105 WebKit::WebPopupType popup_type, |
102 int* route_id); | 106 int* route_id, |
| 107 int* surface_id); |
103 | 108 |
104 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
105 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, | 110 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, |
106 base::SharedMemoryHandle* browser_handle); | 111 base::SharedMemoryHandle* browser_handle); |
107 #endif | 112 #endif |
108 | 113 |
109 IPC::TestSink sink_; | 114 IPC::TestSink sink_; |
110 | 115 |
111 // Routing id what will be assigned to the Widget. | 116 // Routing id what will be assigned to the Widget. |
112 int32 routing_id_; | 117 int32 routing_id_; |
113 | 118 |
| 119 // Surface id what will be assigned to the Widget. |
| 120 int32 surface_id_; |
| 121 |
114 // Opener id reported by the Widget. | 122 // Opener id reported by the Widget. |
115 int32 opener_id_; | 123 int32 opener_id_; |
116 | 124 |
117 // We only keep track of one Widget, we learn its pointer when it | 125 // We only keep track of one Widget, we learn its pointer when it |
118 // adds a new route. | 126 // adds a new route. |
119 IPC::Channel::Listener* widget_; | 127 IPC::Channel::Listener* widget_; |
120 | 128 |
121 // The last known good deserializer for sync messages. | 129 // The last known good deserializer for sync messages. |
122 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; | 130 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; |
123 }; | 131 }; |
124 | 132 |
125 } // namespace content | 133 } // namespace content |
126 | 134 |
127 #endif // CONTENT_TEST_MOCK_RENDER_THREAD_H_ | 135 #endif // CONTENT_TEST_MOCK_RENDER_THREAD_H_ |
OLD | NEW |