OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ |
6 #define COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ | 6 #define COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "cc/layers/texture_layer.h" | 12 #include "cc/layers/texture_layer.h" |
13 #include "cc/layers/texture_layer_client.h" | 13 #include "cc/layers/texture_layer_client.h" |
14 #include "third_party/WebKit/public/platform/WebExternalTextureLayer.h" | 14 #include "third_party/WebKit/public/platform/WebExternalTextureLayer.h" |
15 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" | 15 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" |
16 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" | 16 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" |
17 #include "third_party/WebKit/public/platform/WebLayer.h" | 17 #include "third_party/WebKit/public/platform/WebLayer.h" |
18 #include "third_party/WebKit/public/web/WebDocument.h" | 18 #include "third_party/WebKit/public/web/WebDocument.h" |
19 #include "third_party/WebKit/public/web/WebElement.h" | 19 #include "third_party/WebKit/public/web/WebElement.h" |
20 #include "third_party/WebKit/public/web/WebPlugin.h" | 20 #include "third_party/WebKit/public/web/WebPlugin.h" |
21 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 21 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
22 #include "third_party/khronos/GLES2/gl2.h" | 22 #include "third_party/khronos/GLES2/gl2.h" |
23 | 23 |
24 namespace blink { | 24 namespace blink { |
25 class WebFrame; | 25 class WebFrame; |
26 class WebGraphicsContext3D; | |
27 class WebGraphicsContext3DProvider; | 26 class WebGraphicsContext3DProvider; |
28 class WebLayer; | 27 class WebLayer; |
29 struct WebPluginParams; | 28 struct WebPluginParams; |
30 } | 29 } |
31 | 30 |
32 namespace cc { | 31 namespace cc { |
33 class SharedBitmap; | 32 class SharedBitmap; |
34 } | 33 } |
35 | 34 |
36 namespace gpu { | 35 namespace gpu { |
37 namespace gles2 { | 36 namespace gles2 { |
38 class GLES2Interface; | 37 class GLES2Interface; |
39 } | 38 } |
40 } | 39 } |
41 | 40 |
42 namespace test_runner { | 41 namespace test_runner { |
43 | 42 |
44 class WebTestDelegate; | 43 class WebTestDelegate; |
45 | 44 |
46 // A fake implemention of blink::WebPlugin for testing purposes. | 45 // A fake implemention of blink::WebPlugin for testing purposes. |
47 // | 46 // |
48 // It uses WebGraphicsContext3D to paint a scene consisiting of a primitive | 47 // It uses GL to paint a scene consisiting of a primitive over a background. The |
49 // over a background. The primitive and background can be customized using | 48 // primitive and background can be customized using the following plugin |
50 // the following plugin parameters: | 49 // parameters. |
51 // primitive: none (default), triangle. | 50 // primitive: none (default), triangle. |
52 // background-color: black (default), red, green, blue. | 51 // background-color: black (default), red, green, blue. |
53 // primitive-color: black (default), red, green, blue. | 52 // primitive-color: black (default), red, green, blue. |
54 // opacity: [0.0 - 1.0]. Default is 1.0. | 53 // opacity: [0.0 - 1.0]. Default is 1.0. |
55 // | 54 // |
56 // Whether the plugin accepts touch events or not can be customized using the | 55 // Whether the plugin accepts touch events or not can be customized using the |
57 // 'accepts-touch' plugin parameter (defaults to false). | 56 // 'accepts-touch' plugin parameter (defaults to false). |
58 class TestPlugin : public blink::WebPlugin, public cc::TextureLayerClient { | 57 class TestPlugin : public blink::WebPlugin, public cc::TextureLayerClient { |
59 public: | 58 public: |
60 static TestPlugin* create(blink::WebFrame* frame, | 59 static TestPlugin* create(blink::WebFrame* frame, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 151 |
153 // Functions for drawing scene in Software. | 152 // Functions for drawing scene in Software. |
154 void DrawSceneSoftware(void* memory); | 153 void DrawSceneSoftware(void* memory); |
155 | 154 |
156 blink::WebFrame* frame_; | 155 blink::WebFrame* frame_; |
157 WebTestDelegate* delegate_; | 156 WebTestDelegate* delegate_; |
158 blink::WebPluginContainer* container_; | 157 blink::WebPluginContainer* container_; |
159 | 158 |
160 blink::WebRect rect_; | 159 blink::WebRect rect_; |
161 std::unique_ptr<blink::WebGraphicsContext3DProvider> context_provider_; | 160 std::unique_ptr<blink::WebGraphicsContext3DProvider> context_provider_; |
162 blink::WebGraphicsContext3D* context_; | |
163 gpu::gles2::GLES2Interface* gl_; | 161 gpu::gles2::GLES2Interface* gl_; |
164 GLuint color_texture_; | 162 GLuint color_texture_; |
165 cc::TextureMailbox texture_mailbox_; | 163 cc::TextureMailbox texture_mailbox_; |
166 std::unique_ptr<cc::SharedBitmap> shared_bitmap_; | 164 std::unique_ptr<cc::SharedBitmap> shared_bitmap_; |
167 bool mailbox_changed_; | 165 bool mailbox_changed_; |
168 GLuint framebuffer_; | 166 GLuint framebuffer_; |
169 Scene scene_; | 167 Scene scene_; |
170 scoped_refptr<cc::TextureLayer> layer_; | 168 scoped_refptr<cc::TextureLayer> layer_; |
171 std::unique_ptr<blink::WebLayer> web_layer_; | 169 std::unique_ptr<blink::WebLayer> web_layer_; |
172 | 170 |
173 blink::WebPluginContainer::TouchEventRequestType touch_event_request_; | 171 blink::WebPluginContainer::TouchEventRequestType touch_event_request_; |
174 // Requests touch events from the WebPluginContainerImpl multiple times to | 172 // Requests touch events from the WebPluginContainerImpl multiple times to |
175 // tickle webkit.org/b/108381 | 173 // tickle webkit.org/b/108381 |
176 bool re_request_touch_events_; | 174 bool re_request_touch_events_; |
177 bool print_event_details_; | 175 bool print_event_details_; |
178 bool print_user_gesture_status_; | 176 bool print_user_gesture_status_; |
179 bool can_process_drag_; | 177 bool can_process_drag_; |
180 bool supports_keyboard_focus_; | 178 bool supports_keyboard_focus_; |
181 | 179 |
182 bool is_persistent_; | 180 bool is_persistent_; |
183 bool can_create_without_renderer_; | 181 bool can_create_without_renderer_; |
184 | 182 |
185 DISALLOW_COPY_AND_ASSIGN(TestPlugin); | 183 DISALLOW_COPY_AND_ASSIGN(TestPlugin); |
186 }; | 184 }; |
187 | 185 |
188 } // namespace test_runner | 186 } // namespace test_runner |
189 | 187 |
190 #endif // COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ | 188 #endif // COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ |
OLD | NEW |