| 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 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 TestBrowserPluginGuest(int instance_id, WebContentsImpl* web_contents); | 24 TestBrowserPluginGuest(int instance_id, WebContentsImpl* web_contents); |
| 25 virtual ~TestBrowserPluginGuest(); | 25 virtual ~TestBrowserPluginGuest(); |
| 26 | 26 |
| 27 WebContentsImpl* web_contents() const; | 27 WebContentsImpl* web_contents() const; |
| 28 | 28 |
| 29 // Overridden methods from BrowserPluginGuest to intercept in test objects. | 29 // Overridden methods from BrowserPluginGuest to intercept in test objects. |
| 30 virtual void OnHandleInputEvent(int instance_id, | 30 virtual void OnHandleInputEvent(int instance_id, |
| 31 const gfx::Rect& guest_window_rect, | 31 const gfx::Rect& guest_window_rect, |
| 32 const blink::WebInputEvent* event) OVERRIDE; | 32 const blink::WebInputEvent* event) OVERRIDE; |
| 33 virtual void OnSetFocus(int instance_id, bool focused) OVERRIDE; | |
| 34 virtual void OnTakeFocus(bool reverse) OVERRIDE; | |
| 35 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; | 33 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; |
| 36 virtual void OnImeCancelComposition() OVERRIDE; | 34 virtual void OnImeCancelComposition() OVERRIDE; |
| 37 | 35 |
| 38 // Test utilities to wait for a event we are interested in. | 36 // Test utilities to wait for a event we are interested in. |
| 39 // Waits until UpdateRect message is sent from the guest, meaning it is | 37 // Waits until UpdateRect message is sent from the guest, meaning it is |
| 40 // ready/rendered. | 38 // ready/rendered. |
| 41 void WaitForUpdateRectMsg(); | 39 void WaitForUpdateRectMsg(); |
| 42 void ResetUpdateRectCount(); | |
| 43 // Waits for focus to reach this guest. | |
| 44 void WaitForFocus(); | |
| 45 // Waits for blur to reach this guest. | 40 // Waits for blur to reach this guest. |
| 46 void WaitForBlur(); | |
| 47 // Waits for focus to move out of this guest. | |
| 48 void WaitForAdvanceFocus(); | |
| 49 // Waits until input is observed. | |
| 50 void WaitForInput(); | 41 void WaitForInput(); |
| 51 // Waits until 'loadstop' is observed. | 42 // Waits until 'loadstop' is observed. |
| 52 void WaitForLoadStop(); | 43 void WaitForLoadStop(); |
| 53 // Waits until UpdateRect with a particular |view_size| is observed. | 44 // Waits until UpdateRect with a particular |view_size| is observed. |
| 54 void WaitForViewSize(const gfx::Size& view_size); | 45 void WaitForViewSize(const gfx::Size& view_size); |
| 55 // Waits until IME cancellation is observed. | 46 // Waits until IME cancellation is observed. |
| 56 void WaitForImeCancel(); | 47 void WaitForImeCancel(); |
| 57 | 48 |
| 58 ui::TextInputType last_text_input_type() { | 49 ui::TextInputType last_text_input_type() { |
| 59 return last_text_input_type_; | 50 return last_text_input_type_; |
| 60 } | 51 } |
| 61 | 52 |
| 62 private: | 53 private: |
| 63 // Overridden methods from BrowserPluginGuest to intercept in test objects. | 54 // Overridden methods from BrowserPluginGuest to intercept in test objects. |
| 64 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; | 55 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; |
| 65 | 56 |
| 66 int update_rect_count_; | 57 int update_rect_count_; |
| 67 bool focus_observed_; | |
| 68 bool blur_observed_; | |
| 69 bool advance_focus_observed_; | 58 bool advance_focus_observed_; |
| 70 bool input_observed_; | 59 bool input_observed_; |
| 71 bool load_stop_observed_; | 60 bool load_stop_observed_; |
| 72 bool ime_cancel_observed_; | 61 bool ime_cancel_observed_; |
| 73 gfx::Size last_view_size_observed_; | |
| 74 gfx::Size expected_auto_view_size_; | |
| 75 | 62 |
| 76 scoped_refptr<MessageLoopRunner> send_message_loop_runner_; | 63 scoped_refptr<MessageLoopRunner> send_message_loop_runner_; |
| 77 scoped_refptr<MessageLoopRunner> focus_message_loop_runner_; | |
| 78 scoped_refptr<MessageLoopRunner> blur_message_loop_runner_; | |
| 79 scoped_refptr<MessageLoopRunner> advance_focus_message_loop_runner_; | |
| 80 scoped_refptr<MessageLoopRunner> input_message_loop_runner_; | 64 scoped_refptr<MessageLoopRunner> input_message_loop_runner_; |
| 81 scoped_refptr<MessageLoopRunner> load_stop_message_loop_runner_; | 65 scoped_refptr<MessageLoopRunner> load_stop_message_loop_runner_; |
| 82 scoped_refptr<MessageLoopRunner> auto_view_size_message_loop_runner_; | |
| 83 scoped_refptr<MessageLoopRunner> ime_cancel_message_loop_runner_; | 66 scoped_refptr<MessageLoopRunner> ime_cancel_message_loop_runner_; |
| 84 | 67 |
| 85 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); | 68 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); |
| 86 }; | 69 }; |
| 87 | 70 |
| 88 } // namespace content | 71 } // namespace content |
| 89 | 72 |
| 90 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ | 73 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |