OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/browser_plugin/test_browser_plugin_guest_manager.h" | 5 #include "content/browser/browser_plugin/test_browser_plugin_guest_manager.h" |
6 | 6 |
7 #include "content/browser/web_contents/web_contents_impl.h" | 7 #include "content/browser/web_contents/web_contents_impl.h" |
8 #include "content/public/test/test_utils.h" | 8 #include "content/public/test/test_utils.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 TestBrowserPluginGuestManager::TestBrowserPluginGuestManager() { | 12 TestBrowserPluginGuestManager::TestBrowserPluginGuestManager( |
13 BrowserContext* context) | |
14 : BrowserPluginGuestManager(context), | |
15 last_guest_added_(NULL) { | |
13 } | 16 } |
14 | 17 |
15 TestBrowserPluginGuestManager::~TestBrowserPluginGuestManager() { | 18 TestBrowserPluginGuestManager::~TestBrowserPluginGuestManager() { |
16 } | 19 } |
17 | 20 |
18 void TestBrowserPluginGuestManager::AddGuest( | 21 void TestBrowserPluginGuestManager::AddGuest( |
19 int instance_id, | 22 int instance_id, |
20 WebContentsImpl* guest_web_contents) { | 23 WebContents* guest_web_contents) { |
21 BrowserPluginGuestManager::AddGuest(instance_id, guest_web_contents); | 24 BrowserPluginGuestManager::AddGuest(instance_id, guest_web_contents); |
22 if (message_loop_runner_) | 25 last_guest_added_ = guest_web_contents; |
26 if (message_loop_runner_.get()) | |
23 message_loop_runner_->Quit(); | 27 message_loop_runner_->Quit(); |
24 } | 28 } |
25 | 29 |
26 void TestBrowserPluginGuestManager::WaitForGuestAdded() { | 30 WebContents* TestBrowserPluginGuestManager::WaitForGuestAdded() { |
27 // Check if guests were already created. | 31 // Check if guests were already created. |
28 if (guest_web_contents_by_instance_id_.size() > 0) | 32 if (last_guest_added_) |
lazyboy
2014/05/01 20:06:59
Set last_guest_added_ = NULL after returning the v
Fady Samuel
2014/05/01 21:05:28
Done.
| |
29 return; | 33 return last_guest_added_; |
30 // Wait otherwise. | 34 // Wait otherwise. |
31 message_loop_runner_ = new MessageLoopRunner(); | 35 message_loop_runner_ = new MessageLoopRunner(); |
32 message_loop_runner_->Run(); | 36 message_loop_runner_->Run(); |
37 return last_guest_added_; | |
33 } | 38 } |
34 | 39 |
35 } // namespace content | 40 } // namespace content |
OLD | NEW |