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

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

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: Fix mac build + Address nits from awong@ Created 8 years, 4 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.cc
diff --git a/content/browser/browser_plugin/test_browser_plugin_guest.cc b/content/browser/browser_plugin/test_browser_plugin_guest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b2ef28d3dca02997c3491fd81f946222fe3235c0
--- /dev/null
+++ b/content/browser/browser_plugin/test_browser_plugin_guest.cc
@@ -0,0 +1,64 @@
+// 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.
+
+#include "content/browser/browser_plugin/test_browser_plugin_guest.h"
+
+#include "content/browser/browser_plugin/browser_plugin_guest.h"
+#include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/common/browser_plugin_messages.h"
+#include "content/public/test/test_utils.h"
+#include "ipc/ipc_channel_handle.h"
+#include "ipc/ipc_sync_message.h"
+
+namespace content {
+
+class BrowserPluginGuest;
+
+TestBrowserPluginGuest::TestBrowserPluginGuest(
+ int instance_id,
+ WebContentsImpl* web_contents,
+ RenderViewHost* render_view_host) : BrowserPluginGuest(instance_id,
awong 2012/09/06 00:23:27 initializer lists should go on the next line if th
lazyboy 2012/09/06 04:33:53 Done.
+ web_contents,
+ render_view_host),
+ update_rect_count_(0),
+ crash_observed_(false) {
+}
+
+TestBrowserPluginGuest::~TestBrowserPluginGuest() {
+}
+
+void TestBrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) {
+ if (msg->type() == BrowserPluginMsg_UpdateRect::ID) {
+ update_rect_count_++;
+ if (send_message_loop_runner_)
+ send_message_loop_runner_->Quit();
+ }
+ BrowserPluginGuest::SendMessageToEmbedder(msg);
+}
+
+void TestBrowserPluginGuest::WaitForUpdateRectMsg() {
+ // Check if we already got any UpdateRect message.
+ if (update_rect_count_ > 0)
+ return;
+ send_message_loop_runner_= new MessageLoopRunner();
+ send_message_loop_runner_->Run();
+}
+
+void TestBrowserPluginGuest::RenderViewGone(base::TerminationStatus status) {
+ crash_observed_ = true;
+ if (crash_message_loop_runner_)
+ crash_message_loop_runner_->Quit();
+ BrowserPluginGuest::RenderViewGone(status);
+}
+
+void TestBrowserPluginGuest::WaitForCrashed() {
+ // Check if we already observed a guest crash, return immediately if so.
+ if (crash_observed_)
+ return;
+ crash_message_loop_runner_ = new MessageLoopRunner();
+ crash_message_loop_runner_->Run();
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698