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

Unified Diff: components/guest_view/browser/test_guest_view_manager.cc

Issue 1237343002: Fix nested GuestView's container bounds calculation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix type mismatch for win_x64 compile Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: components/guest_view/browser/test_guest_view_manager.cc
diff --git a/components/guest_view/browser/test_guest_view_manager.cc b/components/guest_view/browser/test_guest_view_manager.cc
index 78458ef1d6c8fb4f12eac78fa3c1af5d3647afca..c23399ab3e906b04ed4bd2cb9f63c70a013a2e05 100644
--- a/components/guest_view/browser/test_guest_view_manager.cc
+++ b/components/guest_view/browser/test_guest_view_manager.cc
@@ -15,7 +15,9 @@ TestGuestViewManager::TestGuestViewManager(
: GuestViewManager(context, delegate.Pass()),
num_embedder_processes_destroyed_(0),
num_guests_created_(0),
- num_views_garbage_collected_(0) {
+ expected_num_guests_created_(0),
+ num_views_garbage_collected_(0),
+ waiting_for_guests_created_(false) {
}
TestGuestViewManager::~TestGuestViewManager() {
@@ -51,22 +53,28 @@ void TestGuestViewManager::WaitForLastGuestDeleted() {
guest_web_contents_watchers_.back()->Wait();
};
-void TestGuestViewManager::WaitForGuestCreated() {
- created_message_loop_runner_ = new content::MessageLoopRunner;
- created_message_loop_runner_->Run();
-}
-
content::WebContents* TestGuestViewManager::WaitForSingleGuestCreated() {
if (!GetNumGuestsActive()) {
// Guests have been created and subsequently destroyed.
if (num_guests_created() > 0)
return nullptr;
- WaitForGuestCreated();
+ WaitForNumGuestsCreated(1u);
}
return GetLastGuestCreated();
}
+void TestGuestViewManager::WaitForNumGuestsCreated(size_t count) {
+ if (count == num_guests_created_)
+ return;
+
+ waiting_for_guests_created_ = true;
+ expected_num_guests_created_ = count;
+
+ created_message_loop_runner_ = new content::MessageLoopRunner;
+ created_message_loop_runner_->Run();
+}
+
void TestGuestViewManager::WaitForViewGarbageCollected() {
gc_message_loop_runner_ = new content::MessageLoopRunner;
gc_message_loop_runner_->Run();
@@ -86,11 +94,21 @@ void TestGuestViewManager::AddGuest(int guest_instance_id,
new content::WebContentsDestroyedWatcher(guest_web_contents)));
++num_guests_created_;
+ if (!waiting_for_guests_created_ &&
+ num_guests_created_ != expected_num_guests_created_) {
+ return;
+ }
if (created_message_loop_runner_.get())
created_message_loop_runner_->Quit();
}
+void TestGuestViewManager::GetGuestWebContentsList(
+ std::vector<content::WebContents*>* guest_web_contents_list) {
+ for (auto& watcher : guest_web_contents_watchers_)
+ guest_web_contents_list->push_back(watcher->web_contents());
+}
+
void TestGuestViewManager::RemoveGuest(int guest_instance_id) {
GuestViewManager::RemoveGuest(guest_instance_id);
}
« no previous file with comments | « components/guest_view/browser/test_guest_view_manager.h ('k') | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698