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