Chromium Code Reviews| Index: content/browser/browser_plugin/test_browser_plugin_guest.h |
| diff --git a/content/browser/browser_plugin/test_browser_plugin_guest.h b/content/browser/browser_plugin/test_browser_plugin_guest.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..68308e4863124522af1ce3ebba9ece84f9498b90 |
| --- /dev/null |
| +++ b/content/browser/browser_plugin/test_browser_plugin_guest.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
| +#define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |
| + |
| +#include "base/compiler_specific.h" |
| +#include "base/process_util.h" |
| +#include "content/browser/browser_plugin/browser_plugin_guest.h" |
| +#include "content/public/test/test_utils.h" |
| +#include "ipc/ipc_channel_handle.h" |
| + |
| +class WebContentsImpl; |
| + |
| +namespace content { |
| + |
| +class RenderProcessHost; |
| +class RenderViewHost; |
| + |
| +// Test class for BrowserPluginGuest. |
| +// Provides utilities to wait for certain state/messages in BrowserPluginGuest |
| +// to be used in tests. |
| +class TestBrowserPluginGuest : public BrowserPluginGuest { |
| + public: |
| + TestBrowserPluginGuest(int instance_id, |
| + WebContentsImpl* web_contents, |
| + RenderViewHost* render_view_host); |
| + virtual ~TestBrowserPluginGuest(); |
| + |
| + // Test utilities. |
| + // Waits until UpdateRect message is sent from the guest, meaning it is |
| + // ready/rendered. |
| + void WaitForUpdateRectMsg(); |
| + // Waits until guest crashes. |
| + void WaitForCrashed(); |
| + |
| + private: |
| + // Overriden methods from BrowserPluginGuest to intercept in test objects. |
| + virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE; |
| + virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| + |
| + int update_rect_count_; |
| + bool crash_observed_; |
| + |
| + scoped_refptr<MessageLoopRunner> send_message_loop_runner_; |
|
Fady Samuel
2012/08/29 08:53:07
Do we need to use two message loop runners?
lazyboy
2012/08/29 21:24:44
Using two message loop is clearer and error-free s
|
| + scoped_refptr<MessageLoopRunner> crash_message_loop_runner_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_ |