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

Side by Side Diff: content/browser/browser_plugin/test_browser_plugin_guest_manager.cc

Issue 261013005: BrowserPlugin: Move CreateGuest to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_simplify_api
Patch Set: Fixed content_browsertests after a change Created 6 years, 7 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 unified diff | Download patch
OLDNEW
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/browser_plugin/browser_plugin_guest.h"
7 #include "content/browser/web_contents/web_contents_impl.h" 8 #include "content/browser/web_contents/web_contents_impl.h"
8 #include "content/public/test/test_utils.h" 9 #include "content/public/test/test_utils.h"
9 10
10 namespace content { 11 namespace content {
11 12
12 TestBrowserPluginGuestManager::TestBrowserPluginGuestManager( 13 TestBrowserPluginGuestManager::TestBrowserPluginGuestManager(
13 BrowserContext* context) 14 BrowserContext* context)
14 : BrowserPluginGuestManager(context), 15 : BrowserPluginGuestManager(context),
15 last_guest_added_(NULL) { 16 last_guest_added_(NULL) {
16 } 17 }
17 18
18 TestBrowserPluginGuestManager::~TestBrowserPluginGuestManager() { 19 TestBrowserPluginGuestManager::~TestBrowserPluginGuestManager() {
19 } 20 }
20 21
21 void TestBrowserPluginGuestManager::AddGuest( 22 BrowserPluginGuest* TestBrowserPluginGuestManager::CreateGuest(
23 SiteInstance* embedder_site_instance,
22 int instance_id, 24 int instance_id,
23 WebContents* guest_web_contents) { 25 const std::string& storage_partition_id,
24 BrowserPluginGuestManager::AddGuest(instance_id, guest_web_contents); 26 bool persist_storage,
25 last_guest_added_ = guest_web_contents; 27 scoped_ptr<base::DictionaryValue> extra_params) {
28 BrowserPluginGuest* guest = BrowserPluginGuestManager::CreateGuest(
29 embedder_site_instance,
30 instance_id,
31 storage_partition_id,
32 persist_storage,
33 extra_params.Pass());
34 last_guest_added_ = guest->GetWebContents();
26 if (message_loop_runner_.get()) 35 if (message_loop_runner_.get())
27 message_loop_runner_->Quit(); 36 message_loop_runner_->Quit();
37 return guest;
28 } 38 }
29 39
30 WebContents* TestBrowserPluginGuestManager::WaitForGuestAdded() { 40 WebContents* TestBrowserPluginGuestManager::WaitForGuestAdded() {
31 // Check if guests were already created. 41 // Check if guests were already created.
32 if (last_guest_added_) { 42 if (last_guest_added_) {
33 WebContents* last_guest_added = last_guest_added_; 43 WebContents* last_guest_added = last_guest_added_;
34 last_guest_added_ = NULL; 44 last_guest_added_ = NULL;
35 return last_guest_added; 45 return last_guest_added;
36 } 46 }
37 // Wait otherwise. 47 // Wait otherwise.
38 message_loop_runner_ = new MessageLoopRunner(); 48 message_loop_runner_ = new MessageLoopRunner();
39 message_loop_runner_->Run(); 49 message_loop_runner_->Run();
40 WebContents* last_guest_added = last_guest_added_; 50 WebContents* last_guest_added = last_guest_added_;
41 last_guest_added_ = NULL; 51 last_guest_added_ = NULL;
42 return last_guest_added; 52 return last_guest_added;
43 } 53 }
44 54
45 } // namespace content 55 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698