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_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ | 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 10 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/test/test_utils.h" | 12 #include "content/public/test/test_utils.h" |
| 13 #include "ui/gfx/size.h" |
13 | 14 |
14 class WebContentsImpl; | 15 class WebContentsImpl; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 class RenderProcessHost; | 19 class RenderProcessHost; |
19 class RenderViewHost; | 20 class RenderViewHost; |
20 | 21 |
21 // Test class for BrowserPluginGuest. | 22 // Test class for BrowserPluginGuest. |
22 // | 23 // |
(...skipping 11 matching lines...) Expand all Loading... |
34 virtual void Observe(int type, | 35 virtual void Observe(int type, |
35 const NotificationSource& source, | 36 const NotificationSource& source, |
36 const NotificationDetails& details) OVERRIDE; | 37 const NotificationDetails& details) OVERRIDE; |
37 | 38 |
38 // Overridden methods from BrowserPluginGuest to intercept in test objects. | 39 // Overridden methods from BrowserPluginGuest to intercept in test objects. |
39 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 40 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
40 virtual void SetFocus(bool focused) OVERRIDE; | 41 virtual void SetFocus(bool focused) OVERRIDE; |
41 virtual bool ViewTakeFocus(bool reverse) OVERRIDE; | 42 virtual bool ViewTakeFocus(bool reverse) OVERRIDE; |
42 virtual void Reload() OVERRIDE; | 43 virtual void Reload() OVERRIDE; |
43 virtual void Stop() OVERRIDE; | 44 virtual void Stop() OVERRIDE; |
| 45 virtual void SetDamageBuffer(TransportDIB* damage_buffer, |
| 46 #if defined(OS_WIN) |
| 47 int damage_buffer_size, |
| 48 #endif |
| 49 const gfx::Size& damage_view_size, |
| 50 float scale_factor) OVERRIDE; |
44 | 51 |
45 // Test utilities to wait for a event we are interested in. | 52 // Test utilities to wait for a event we are interested in. |
46 // Waits until UpdateRect message is sent from the guest, meaning it is | 53 // Waits until UpdateRect message is sent from the guest, meaning it is |
47 // ready/rendered. | 54 // ready/rendered. |
48 void WaitForUpdateRectMsg(); | 55 void WaitForUpdateRectMsg(); |
49 void ResetUpdateRectCount(); | 56 void ResetUpdateRectCount(); |
50 // Waits until UpdateRect message with a specific size is sent from the guest. | 57 // Waits until a guest receives a damage buffer of the specified |size|. |
51 void WaitForUpdateRectMsgWithSize(int width, int height); | 58 void WaitForDamageBufferWithSize(const gfx::Size& size); |
52 // Waits for focus to reach this guest. | 59 // Waits for focus to reach this guest. |
53 void WaitForFocus(); | 60 void WaitForFocus(); |
54 // Wait for focus to move out of this guest. | 61 // Waits for focus to move out of this guest. |
55 void WaitForAdvanceFocus(); | 62 void WaitForAdvanceFocus(); |
56 // Wait until the guest is hidden. | 63 // Waits until the guest is hidden. |
57 void WaitUntilHidden(); | 64 void WaitUntilHidden(); |
58 // Waits until guest crashes. | 65 // Waits until guest crashes. |
59 void WaitForCrashed(); | 66 void WaitForCrashed(); |
60 // Wait until a reload request is observed. | 67 // Waits until a reload request is observed. |
61 void WaitForReload(); | 68 void WaitForReload(); |
62 // Wait until a stop request is observed. | 69 // Waits until a stop request is observed. |
63 void WaitForStop(); | 70 void WaitForStop(); |
64 | 71 |
65 private: | 72 private: |
66 // Overridden methods from BrowserPluginGuest to intercept in test objects. | 73 // Overridden methods from BrowserPluginGuest to intercept in test objects. |
67 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; | 74 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; |
68 | 75 |
69 int update_rect_count_; | 76 int update_rect_count_; |
| 77 int damage_buffer_call_count_; |
70 bool crash_observed_; | 78 bool crash_observed_; |
71 bool focus_observed_; | 79 bool focus_observed_; |
72 bool advance_focus_observed_; | 80 bool advance_focus_observed_; |
73 bool was_hidden_observed_; | 81 bool was_hidden_observed_; |
74 bool stop_observed_; | 82 bool stop_observed_; |
75 bool reload_observed_; | 83 bool reload_observed_; |
| 84 bool set_damage_buffer_observed_; |
76 | 85 |
77 // For WaitForUpdateRectMsgWithSize(). | 86 // For WaitForDamageBufferWithSize(). |
78 bool waiting_for_update_rect_msg_with_size_; | 87 bool waiting_for_damage_buffer_with_size_; |
79 int expected_width_; | 88 gfx::Size expected_damage_buffer_size_; |
80 int expected_height_; | 89 gfx::Size last_damage_buffer_size_; |
81 | |
82 int last_update_rect_width_; | |
83 int last_update_rect_height_; | |
84 | 90 |
85 scoped_refptr<MessageLoopRunner> send_message_loop_runner_; | 91 scoped_refptr<MessageLoopRunner> send_message_loop_runner_; |
86 scoped_refptr<MessageLoopRunner> crash_message_loop_runner_; | 92 scoped_refptr<MessageLoopRunner> crash_message_loop_runner_; |
87 scoped_refptr<MessageLoopRunner> focus_message_loop_runner_; | 93 scoped_refptr<MessageLoopRunner> focus_message_loop_runner_; |
88 scoped_refptr<MessageLoopRunner> advance_focus_message_loop_runner_; | 94 scoped_refptr<MessageLoopRunner> advance_focus_message_loop_runner_; |
89 scoped_refptr<MessageLoopRunner> was_hidden_message_loop_runner_; | 95 scoped_refptr<MessageLoopRunner> was_hidden_message_loop_runner_; |
90 scoped_refptr<MessageLoopRunner> reload_message_loop_runner_; | 96 scoped_refptr<MessageLoopRunner> reload_message_loop_runner_; |
91 scoped_refptr<MessageLoopRunner> stop_message_loop_runner_; | 97 scoped_refptr<MessageLoopRunner> stop_message_loop_runner_; |
| 98 scoped_refptr<MessageLoopRunner> damage_buffer_message_loop_runner_; |
92 | 99 |
93 // A scoped container for notification registries. | 100 // A scoped container for notification registries. |
94 NotificationRegistrar registrar_; | 101 NotificationRegistrar registrar_; |
95 | 102 |
96 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); | 103 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); |
97 }; | 104 }; |
98 | 105 |
99 } // namespace content | 106 } // namespace content |
100 | 107 |
101 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ | 108 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |