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

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 2506183002: Make window.open() IPCs be frame-based (Closed)
Patch Set: Rebase. Created 3 years, 11 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index bd092ddf53310a7b9c44ecbd81c0ebc19430f28a..e4ddf6e9978bb9338490d596eb20f31795b9e2ce 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -2617,14 +2617,32 @@ TEST_F(WebContentsImplTest, FilterURLs) {
// Test that if a pending contents is deleted before it is shown, we don't
// crash.
-TEST_F(WebContentsImplTest, PendingContents) {
+TEST_F(WebContentsImplTest, PendingContentsDestroyed) {
std::unique_ptr<TestWebContents> other_contents(
static_cast<TestWebContents*>(CreateTestWebContents()));
contents()->AddPendingContents(other_contents.get());
- int process_id = other_contents->GetRenderViewHost()->GetProcess()->GetID();
- int route_id = other_contents->GetRenderViewHost()->GetRoutingID();
+ RenderWidgetHost* widget =
+ other_contents->GetMainFrame()->GetRenderWidgetHost();
+ int process_id = widget->GetProcess()->GetID();
+ int widget_id = widget->GetRoutingID();
other_contents.reset();
- EXPECT_EQ(nullptr, contents()->GetCreatedWindow(process_id, route_id));
+ EXPECT_EQ(nullptr, contents()->GetCreatedWindow(process_id, widget_id));
+}
+
+TEST_F(WebContentsImplTest, PendingContentsShown) {
+ std::unique_ptr<TestWebContents> other_contents(
+ static_cast<TestWebContents*>(CreateTestWebContents()));
+ contents()->AddPendingContents(other_contents.get());
+ RenderWidgetHost* widget =
+ other_contents->GetMainFrame()->GetRenderWidgetHost();
+ int process_id = widget->GetProcess()->GetID();
+ int widget_id = widget->GetRoutingID();
+
+ // The first call to GetCreatedWindow pops it off the pending list.
+ EXPECT_EQ(other_contents.get(),
+ contents()->GetCreatedWindow(process_id, widget_id));
+ // A second call should return nullptr, verifying that it's been forgotten.
+ EXPECT_EQ(nullptr, contents()->GetCreatedWindow(process_id, widget_id));
}
TEST_F(WebContentsImplTest, CapturerOverridesPreferredSize) {
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698