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 "content/browser/browser_plugin/browser_plugin_guest.h" | 9 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
10 #include "content/public/test/test_utils.h" | 10 #include "content/public/test/test_utils.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 WebContentsImpl* web_contents() const; | 28 WebContentsImpl* web_contents() const; |
29 | 29 |
30 // Overridden methods from BrowserPluginGuest to intercept in test objects. | 30 // Overridden methods from BrowserPluginGuest to intercept in test objects. |
31 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 31 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
32 virtual void OnHandleInputEvent(int instance_id, | 32 virtual void OnHandleInputEvent(int instance_id, |
33 const gfx::Rect& guest_window_rect, | 33 const gfx::Rect& guest_window_rect, |
34 const blink::WebInputEvent* event) OVERRIDE; | 34 const blink::WebInputEvent* event) OVERRIDE; |
35 virtual void OnSetFocus(int instance_id, bool focused) OVERRIDE; | 35 virtual void OnSetFocus(int instance_id, bool focused) OVERRIDE; |
36 virtual void OnTakeFocus(bool reverse) OVERRIDE; | 36 virtual void OnTakeFocus(bool reverse) OVERRIDE; |
37 virtual void SetDamageBuffer( | |
38 const BrowserPluginHostMsg_ResizeGuest_Params& params) OVERRIDE; | |
39 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; | 37 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; |
40 virtual void OnImeCancelComposition() OVERRIDE; | 38 virtual void OnImeCancelComposition() OVERRIDE; |
| 39 virtual void OnResizeGuest( |
| 40 int instance_id, |
| 41 const BrowserPluginHostMsg_ResizeGuest_Params& params) OVERRIDE; |
41 | 42 |
42 // Overridden from WebContentsObserver. | 43 // Overridden from WebContentsObserver. |
43 virtual void WasHidden() OVERRIDE; | 44 virtual void WasHidden() OVERRIDE; |
44 | 45 |
45 // Test utilities to wait for a event we are interested in. | 46 // Test utilities to wait for a event we are interested in. |
46 // Waits until UpdateRect message is sent from the guest, meaning it is | 47 // Waits until UpdateRect message is sent from the guest, meaning it is |
47 // ready/rendered. | 48 // ready/rendered. |
48 void WaitForUpdateRectMsg(); | 49 void WaitForUpdateRectMsg(); |
49 void ResetUpdateRectCount(); | 50 void ResetUpdateRectCount(); |
50 // Waits until a guest receives a damage buffer of the specified |size|. | |
51 void WaitForDamageBufferWithSize(const gfx::Size& size); | |
52 // Waits for focus to reach this guest. | 51 // Waits for focus to reach this guest. |
53 void WaitForFocus(); | 52 void WaitForFocus(); |
54 // Waits for blur to reach this guest. | 53 // Waits for blur to reach this guest. |
55 void WaitForBlur(); | 54 void WaitForBlur(); |
56 // Waits for focus to move out of this guest. | 55 // Waits for focus to move out of this guest. |
57 void WaitForAdvanceFocus(); | 56 void WaitForAdvanceFocus(); |
58 // Waits until the guest is hidden. | 57 // Waits until the guest is hidden. |
59 void WaitUntilHidden(); | 58 void WaitUntilHidden(); |
60 // Waits until guest exits. | 59 // Waits until guest exits. |
61 void WaitForExit(); | 60 void WaitForExit(); |
62 // Waits until input is observed. | 61 // Waits until input is observed. |
63 void WaitForInput(); | 62 void WaitForInput(); |
64 // Waits until 'loadstop' is observed. | 63 // Waits until 'loadstop' is observed. |
65 void WaitForLoadStop(); | 64 void WaitForLoadStop(); |
66 // Waits until UpdateRect with a particular |view_size| is observed. | 65 // Waits until UpdateRect with a particular |view_size| is observed. |
67 void WaitForViewSize(const gfx::Size& view_size); | 66 void WaitForViewSize(const gfx::Size& view_size); |
68 // Waits until IME cancellation is observed. | 67 // Waits until IME cancellation is observed. |
69 void WaitForImeCancel(); | 68 void WaitForImeCancel(); |
| 69 // Waits until we have seen a resize guest of size |view_size|. |
| 70 void WaitForResizeGuest(const gfx::Size& view_size); |
70 | 71 |
71 void set_guest_hang_timeout(const base::TimeDelta& timeout) { | 72 void set_guest_hang_timeout(const base::TimeDelta& timeout) { |
72 guest_hang_timeout_ = timeout; | 73 guest_hang_timeout_ = timeout; |
73 } | 74 } |
74 | 75 |
75 ui::TextInputType last_text_input_type() { | 76 ui::TextInputType last_text_input_type() { |
76 return last_text_input_type_; | 77 return last_text_input_type_; |
77 } | 78 } |
78 | 79 |
79 private: | 80 private: |
80 // Overridden methods from BrowserPluginGuest to intercept in test objects. | 81 // Overridden methods from BrowserPluginGuest to intercept in test objects. |
81 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; | 82 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; |
82 | 83 |
83 int update_rect_count_; | 84 int update_rect_count_; |
84 int damage_buffer_call_count_; | |
85 bool exit_observed_; | 85 bool exit_observed_; |
86 bool focus_observed_; | 86 bool focus_observed_; |
87 bool blur_observed_; | 87 bool blur_observed_; |
88 bool advance_focus_observed_; | 88 bool advance_focus_observed_; |
89 bool was_hidden_observed_; | 89 bool was_hidden_observed_; |
90 bool set_damage_buffer_observed_; | |
91 bool input_observed_; | 90 bool input_observed_; |
92 bool load_stop_observed_; | 91 bool load_stop_observed_; |
93 bool ime_cancel_observed_; | 92 bool ime_cancel_observed_; |
94 gfx::Size last_view_size_observed_; | 93 gfx::Size last_view_size_observed_; |
95 gfx::Size expected_auto_view_size_; | 94 gfx::Size expected_auto_view_size_; |
96 | 95 gfx::Size last_size_observed_in_resize_; |
97 // For WaitForDamageBufferWithSize(). | 96 gfx::Size expected_view_size_in_resize_; |
98 bool waiting_for_damage_buffer_with_size_; | |
99 gfx::Size expected_damage_buffer_size_; | |
100 gfx::Size last_damage_buffer_size_; | |
101 | 97 |
102 scoped_refptr<MessageLoopRunner> send_message_loop_runner_; | 98 scoped_refptr<MessageLoopRunner> send_message_loop_runner_; |
103 scoped_refptr<MessageLoopRunner> crash_message_loop_runner_; | 99 scoped_refptr<MessageLoopRunner> crash_message_loop_runner_; |
104 scoped_refptr<MessageLoopRunner> focus_message_loop_runner_; | 100 scoped_refptr<MessageLoopRunner> focus_message_loop_runner_; |
105 scoped_refptr<MessageLoopRunner> blur_message_loop_runner_; | 101 scoped_refptr<MessageLoopRunner> blur_message_loop_runner_; |
106 scoped_refptr<MessageLoopRunner> advance_focus_message_loop_runner_; | 102 scoped_refptr<MessageLoopRunner> advance_focus_message_loop_runner_; |
107 scoped_refptr<MessageLoopRunner> was_hidden_message_loop_runner_; | 103 scoped_refptr<MessageLoopRunner> was_hidden_message_loop_runner_; |
108 scoped_refptr<MessageLoopRunner> damage_buffer_message_loop_runner_; | |
109 scoped_refptr<MessageLoopRunner> input_message_loop_runner_; | 104 scoped_refptr<MessageLoopRunner> input_message_loop_runner_; |
110 scoped_refptr<MessageLoopRunner> load_stop_message_loop_runner_; | 105 scoped_refptr<MessageLoopRunner> load_stop_message_loop_runner_; |
111 scoped_refptr<MessageLoopRunner> auto_view_size_message_loop_runner_; | 106 scoped_refptr<MessageLoopRunner> auto_view_size_message_loop_runner_; |
112 scoped_refptr<MessageLoopRunner> ime_cancel_message_loop_runner_; | 107 scoped_refptr<MessageLoopRunner> ime_cancel_message_loop_runner_; |
| 108 scoped_refptr<MessageLoopRunner> resize_guest_message_loop_runner_; |
113 | 109 |
114 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); | 110 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); |
115 }; | 111 }; |
116 | 112 |
117 } // namespace content | 113 } // namespace content |
118 | 114 |
119 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ | 115 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |