Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Unified Diff: content/browser/browser_plugin/test_browser_plugin_guest.h

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: Sync + fix test target. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..92d37dade96311b0db49b720307ea3573e6a55f3
--- /dev/null
+++ b/content/browser/browser_plugin/test_browser_plugin_guest.h
@@ -0,0 +1,65 @@
+// 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 UpdateRect message with a specific size is sent from the guest.
+ void WaitForUpdateRectMsgWithSize(int width, int height);
+ // 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_;
+
+ // For WaitForUpdateRectMsgWithSize().
+ bool waiting_for_update_rect_msg_with_size_;
+ int expected_width_;
+ int expected_height_;
+
+ int last_update_rect_width_;
+ int last_update_rect_height_;
+
+ scoped_refptr<MessageLoopRunner> send_message_loop_runner_;
+ scoped_refptr<MessageLoopRunner> crash_message_loop_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_

Powered by Google App Engine
This is Rietveld 408576698