| 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" |
| 11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class RenderProcessHost; | 15 class RenderProcessHost; |
| 16 class RenderViewHost; | 16 class RenderViewHost; |
| 17 class WebContentsImpl; | 17 class WebContentsImpl; |
| 18 | 18 |
| 19 // Test class for BrowserPluginGuest. | 19 // Test class for BrowserPluginGuest. |
| 20 // | 20 // |
| 21 // Provides utilities to wait for certain state/messages in BrowserPluginGuest | 21 // Provides utilities to wait for certain state/messages in BrowserPluginGuest |
| 22 // to be used in tests. | 22 // to be used in tests. |
| 23 class TestBrowserPluginGuest : public BrowserPluginGuest { | 23 class TestBrowserPluginGuest : public BrowserPluginGuest { |
| 24 public: | 24 public: |
| 25 TestBrowserPluginGuest(int instance_id, WebContentsImpl* web_contents); | 25 TestBrowserPluginGuest(int instance_id, WebContentsImpl* web_contents); |
| 26 virtual ~TestBrowserPluginGuest(); | 26 virtual ~TestBrowserPluginGuest(); |
| 27 | 27 |
| 28 WebContentsImpl* web_contents() const; | 28 WebContentsImpl* web_contents() const; |
| 29 | 29 |
| 30 // NotificationObserver method override. | |
| 31 virtual void Observe(int type, | |
| 32 const NotificationSource& source, | |
| 33 const NotificationDetails& details) OVERRIDE; | |
| 34 | |
| 35 // Overridden methods from BrowserPluginGuest to intercept in test objects. | 30 // Overridden methods from BrowserPluginGuest to intercept in test objects. |
| 36 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 31 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
| 37 virtual void OnHandleInputEvent(int instance_id, | 32 virtual void OnHandleInputEvent(int instance_id, |
| 38 const gfx::Rect& guest_window_rect, | 33 const gfx::Rect& guest_window_rect, |
| 39 const WebKit::WebInputEvent* event) OVERRIDE; | 34 const WebKit::WebInputEvent* event) OVERRIDE; |
| 40 virtual void OnSetFocus(int instance_id, bool focused) OVERRIDE; | 35 virtual void OnSetFocus(int instance_id, bool focused) OVERRIDE; |
| 41 virtual void OnTakeFocus(bool reverse) OVERRIDE; | 36 virtual void OnTakeFocus(bool reverse) OVERRIDE; |
| 42 virtual void SetDamageBuffer( | 37 virtual void SetDamageBuffer( |
| 43 const BrowserPluginHostMsg_ResizeGuest_Params& params) OVERRIDE; | 38 const BrowserPluginHostMsg_ResizeGuest_Params& params) OVERRIDE; |
| 44 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; | 39 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; |
| 45 | 40 |
| 41 // Overridden from WebContentsObserver. |
| 42 virtual void WasHidden() OVERRIDE; |
| 43 |
| 46 // Test utilities to wait for a event we are interested in. | 44 // Test utilities to wait for a event we are interested in. |
| 47 // Waits until UpdateRect message is sent from the guest, meaning it is | 45 // Waits until UpdateRect message is sent from the guest, meaning it is |
| 48 // ready/rendered. | 46 // ready/rendered. |
| 49 void WaitForUpdateRectMsg(); | 47 void WaitForUpdateRectMsg(); |
| 50 void ResetUpdateRectCount(); | 48 void ResetUpdateRectCount(); |
| 51 // Waits until a guest receives a damage buffer of the specified |size|. | 49 // Waits until a guest receives a damage buffer of the specified |size|. |
| 52 void WaitForDamageBufferWithSize(const gfx::Size& size); | 50 void WaitForDamageBufferWithSize(const gfx::Size& size); |
| 53 // Waits for focus to reach this guest. | 51 // Waits for focus to reach this guest. |
| 54 void WaitForFocus(); | 52 void WaitForFocus(); |
| 55 // Waits for blur to reach this guest. | 53 // Waits for blur to reach this guest. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 scoped_refptr<MessageLoopRunner> input_message_loop_runner_; | 97 scoped_refptr<MessageLoopRunner> input_message_loop_runner_; |
| 100 scoped_refptr<MessageLoopRunner> load_stop_message_loop_runner_; | 98 scoped_refptr<MessageLoopRunner> load_stop_message_loop_runner_; |
| 101 scoped_refptr<MessageLoopRunner> auto_view_size_message_loop_runner_; | 99 scoped_refptr<MessageLoopRunner> auto_view_size_message_loop_runner_; |
| 102 | 100 |
| 103 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); | 101 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); |
| 104 }; | 102 }; |
| 105 | 103 |
| 106 } // namespace content | 104 } // namespace content |
| 107 | 105 |
| 108 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ | 106 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |