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) { |