OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
| 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/process_util.h" |
| 10 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 11 #include "content/public/test/test_utils.h" |
| 12 #include "ipc/ipc_channel_handle.h" |
| 13 |
| 14 class WebContentsImpl; |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class RenderProcessHost; |
| 19 class RenderViewHost; |
| 20 |
| 21 // Test class for BrowserPluginGuest. |
| 22 // Provides utilities to wait for certain state/messages in BrowserPluginGuest |
| 23 // to be used in tests. |
| 24 class TestBrowserPluginGuest : public BrowserPluginGuest { |
| 25 public: |
| 26 TestBrowserPluginGuest(int instance_id, |
| 27 WebContentsImpl* web_contents, |
| 28 RenderViewHost* render_view_host); |
| 29 virtual ~TestBrowserPluginGuest(); |
| 30 |
| 31 // Test utilities. |
| 32 // Waits until UpdateRect message is sent from the guest, meaning it is |
| 33 // ready/rendered. |
| 34 void WaitForUpdateRectMsg(); |
| 35 // Waits until guest crashes. |
| 36 void WaitForCrashed(); |
| 37 |
| 38 private: |
| 39 // Overriden methods from BrowserPluginGuest to intercept in test objects. |
| 40 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; |
| 41 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| 42 |
| 43 int update_rect_count_; |
| 44 bool crash_observed_; |
| 45 |
| 46 scoped_refptr<MessageLoopRunner> send_message_loop_runner_; |
| 47 scoped_refptr<MessageLoopRunner> crash_message_loop_runner_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); |
| 50 }; |
| 51 |
| 52 } // namespace content |
| 53 |
| 54 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |