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.
5 #include "content/browser/browser_plugin/test_browser_plugin_embedder.h"
7 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
8 #include "content/browser/web_contents/web_contents_impl.h"
12 TestBrowserPluginEmbedder::TestBrowserPluginEmbedder(
13 WebContentsImpl
* web_contents
)
14 : BrowserPluginEmbedder(web_contents
),
15 last_rvh_at_position_response_(NULL
) {
18 TestBrowserPluginEmbedder::~TestBrowserPluginEmbedder() {
21 void 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();
28 void 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();
36 WebContentsImpl
* TestBrowserPluginEmbedder::web_contents() const {
37 return static_cast<WebContentsImpl
*>(BrowserPluginEmbedder::web_contents());
40 } // namespace content