OLD | NEW |
(Empty) | |
| 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 "base/time.h" |
| 8 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
| 9 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 10 #include "content/browser/browser_plugin/test_timeout_tracker.h" |
| 11 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 12 #include "content/browser/web_contents/web_contents_impl.h" |
| 13 #include "content/public/test/test_utils.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 TestBrowserPluginEmbedder::TestBrowserPluginEmbedder( |
| 18 WebContentsImpl* web_contents, |
| 19 RenderViewHost* render_view_host) |
| 20 : BrowserPluginEmbedder(web_contents, render_view_host) { |
| 21 } |
| 22 |
| 23 TestBrowserPluginEmbedder::~TestBrowserPluginEmbedder() { |
| 24 } |
| 25 |
| 26 void TestBrowserPluginEmbedder::AddGuest(int instance_id, |
| 27 BrowserPluginGuest* guest, |
| 28 int64 frame_id) { |
| 29 BrowserPluginEmbedder::AddGuest(instance_id, guest, frame_id); |
| 30 if (message_loop_runner_) |
| 31 message_loop_runner_->Quit(); |
| 32 } |
| 33 |
| 34 bool TestBrowserPluginEmbedder::WaitForGuestAdded() { |
| 35 // Check if guests were already created. |
| 36 if (guest_web_contents_by_instance_id_.size() > 0) |
| 37 return true; |
| 38 // Wait otherwise. |
| 39 message_loop_runner_ = new MessageLoopRunner(); |
| 40 return TestTimeoutTracker::RunInActionTimeout(message_loop_runner_.get()); |
| 41 } |
| 42 |
| 43 } // namespace content |
OLD | NEW |