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

Unified Diff: chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc

Issue 2618573002: Add test to check for crash caused by stale WebContents in chrome://interstitials (Closed)
Patch Set: Fix browser side navigation 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 | « chrome/browser/ui/webui/interstitials/interstitial_ui.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
index eba2e016f8c97bd1b4b759b9f6dc9c56c5b4a234..758921907e04ec4a26dc37b02c0f089dc2cc4399 100644
--- a/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -84,3 +85,20 @@ IN_PROC_BROWSER_TEST_F(InterstitialUITest, CaptivePortalInterstitialWifi) {
TestInterstitial(GURL("chrome://interstitials/captiveportal?is_wifi=1"),
"Connect to Wi-Fi");
}
+
+// Checks that the interstitial page uses correct web contents. If not, closing
+// the tab might result in a freed web contents pointer and cause a crash.
+// See https://crbug.com/611706 for details.
+IN_PROC_BROWSER_TEST_F(InterstitialUITest, UseCorrectWebContents) {
+ int current_tab = browser()->tab_strip_model()->active_index();
+ ui_test_utils::NavigateToURL(browser(), GURL("chrome://interstitials/ssl"));
+
+ // Duplicate the tab and close it.
+ chrome::DuplicateTab(browser());
+ EXPECT_NE(current_tab, browser()->tab_strip_model()->active_index());
+ chrome::CloseTab(browser());
+ EXPECT_EQ(current_tab, browser()->tab_strip_model()->active_index());
+
+ // Reloading the page shouldn't cause a crash.
+ chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
+}
« no previous file with comments | « chrome/browser/ui/webui/interstitials/interstitial_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698