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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // NotificationObserver method override. | 33 // NotificationObserver method override. |
34 virtual void Observe(int type, | 34 virtual void Observe(int type, |
35 const NotificationSource& source, | 35 const NotificationSource& source, |
36 const NotificationDetails& details) OVERRIDE; | 36 const NotificationDetails& details) OVERRIDE; |
37 | 37 |
38 // Overridden methods from BrowserPluginGuest to intercept in test objects. | 38 // Overridden methods from BrowserPluginGuest to intercept in test objects. |
39 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 39 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
40 virtual void SetFocus(bool focused) OVERRIDE; | 40 virtual void SetFocus(bool focused) OVERRIDE; |
41 virtual bool ViewTakeFocus(bool reverse) OVERRIDE; | 41 virtual bool ViewTakeFocus(bool reverse) OVERRIDE; |
| 42 virtual void Reload() OVERRIDE; |
| 43 virtual void Stop() OVERRIDE; |
42 | 44 |
43 // Test utilities to wait for a event we are interested in. | 45 // Test utilities to wait for a event we are interested in. |
44 // 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 |
45 // ready/rendered. | 47 // ready/rendered. |
46 void WaitForUpdateRectMsg(); | 48 void WaitForUpdateRectMsg(); |
| 49 void ResetUpdateRectCount(); |
47 // Waits until UpdateRect message with a specific size is sent from the guest. | 50 // Waits until UpdateRect message with a specific size is sent from the guest. |
48 void WaitForUpdateRectMsgWithSize(int width, int height); | 51 void WaitForUpdateRectMsgWithSize(int width, int height); |
49 // Waits for focus to reach this guest. | 52 // Waits for focus to reach this guest. |
50 void WaitForFocus(); | 53 void WaitForFocus(); |
51 // Wait for focus to move out of this guest. | 54 // Wait for focus to move out of this guest. |
52 void WaitForAdvanceFocus(); | 55 void WaitForAdvanceFocus(); |
53 // Wait until the guest is hidden. | 56 // Wait until the guest is hidden. |
54 void WaitUntilHidden(); | 57 void WaitUntilHidden(); |
55 // Waits until guest crashes. | 58 // Waits until guest crashes. |
56 void WaitForCrashed(); | 59 void WaitForCrashed(); |
| 60 // Wait until a reload request is observed. |
| 61 void WaitForReload(); |
| 62 // Wait until a stop request is observed. |
| 63 void WaitForStop(); |
57 | 64 |
58 private: | 65 private: |
59 // Overridden methods from BrowserPluginGuest to intercept in test objects. | 66 // Overridden methods from BrowserPluginGuest to intercept in test objects. |
60 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; | 67 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; |
61 | 68 |
62 int update_rect_count_; | 69 int update_rect_count_; |
63 bool crash_observed_; | 70 bool crash_observed_; |
64 bool focus_observed_; | 71 bool focus_observed_; |
65 bool advance_focus_observed_; | 72 bool advance_focus_observed_; |
66 bool was_hidden_observed_; | 73 bool was_hidden_observed_; |
| 74 bool stop_observed_; |
| 75 bool reload_observed_; |
67 | 76 |
68 // For WaitForUpdateRectMsgWithSize(). | 77 // For WaitForUpdateRectMsgWithSize(). |
69 bool waiting_for_update_rect_msg_with_size_; | 78 bool waiting_for_update_rect_msg_with_size_; |
70 int expected_width_; | 79 int expected_width_; |
71 int expected_height_; | 80 int expected_height_; |
72 | 81 |
73 int last_update_rect_width_; | 82 int last_update_rect_width_; |
74 int last_update_rect_height_; | 83 int last_update_rect_height_; |
75 | 84 |
76 scoped_refptr<MessageLoopRunner> send_message_loop_runner_; | 85 scoped_refptr<MessageLoopRunner> send_message_loop_runner_; |
77 scoped_refptr<MessageLoopRunner> crash_message_loop_runner_; | 86 scoped_refptr<MessageLoopRunner> crash_message_loop_runner_; |
78 scoped_refptr<MessageLoopRunner> focus_message_loop_runner_; | 87 scoped_refptr<MessageLoopRunner> focus_message_loop_runner_; |
79 scoped_refptr<MessageLoopRunner> advance_focus_message_loop_runner_; | 88 scoped_refptr<MessageLoopRunner> advance_focus_message_loop_runner_; |
80 scoped_refptr<MessageLoopRunner> was_hidden_message_loop_runner_; | 89 scoped_refptr<MessageLoopRunner> was_hidden_message_loop_runner_; |
| 90 scoped_refptr<MessageLoopRunner> reload_message_loop_runner_; |
| 91 scoped_refptr<MessageLoopRunner> stop_message_loop_runner_; |
81 | 92 |
82 // A scoped container for notification registries. | 93 // A scoped container for notification registries. |
83 NotificationRegistrar registrar_; | 94 NotificationRegistrar registrar_; |
84 | 95 |
85 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); | 96 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); |
86 }; | 97 }; |
87 | 98 |
88 } // namespace content | 99 } // namespace content |
89 | 100 |
90 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ | 101 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |