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#include "content/browser/browser_plugin/test_browser_plugin_embedder.h" 6 7#include "content/browser/browser_plugin/browser_plugin_embedder.h" 8#include "content/browser/web_contents/web_contents_impl.h" 9 10namespace content { 11 12TestBrowserPluginEmbedder::TestBrowserPluginEmbedder( 13 WebContentsImpl* web_contents) 14 : BrowserPluginEmbedder(web_contents), 15 last_rvh_at_position_response_(NULL) { 16} 17 18TestBrowserPluginEmbedder::~TestBrowserPluginEmbedder() { 19} 20 21void TestBrowserPluginEmbedder::GetRenderViewHostCallback( 22 RenderViewHost* rvh, int x, int y) { 23 last_rvh_at_position_response_ = rvh; 24 if (message_loop_runner_.get()) 25 message_loop_runner_->Quit(); 26} 27 28void TestBrowserPluginEmbedder::WaitForRenderViewHostAtPosition(int x, int y) { 29 GetRenderViewHostAtPosition(x, y, 30 base::Bind(&TestBrowserPluginEmbedder::GetRenderViewHostCallback, 31 base::Unretained(this))); 32 message_loop_runner_ = new MessageLoopRunner(); 33 message_loop_runner_->Run(); 34} 35 36WebContentsImpl* TestBrowserPluginEmbedder::web_contents() const { 37 return static_cast<WebContentsImpl*>(BrowserPluginEmbedder::web_contents()); 38} 39 40} // namespace content 41