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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/interstitials/interstitial_ui.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/chrome_notification_types.h" 6 #include "chrome/browser/chrome_notification_types.h"
7 #include "chrome/browser/devtools/devtools_window.h" 7 #include "chrome/browser/devtools/devtools_window.h"
8 #include "chrome/browser/devtools/devtools_window_testing.h" 8 #include "chrome/browser/devtools/devtools_window_testing.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
12 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 15
15 class InterstitialUITest : public InProcessBrowserTest { 16 class InterstitialUITest : public InProcessBrowserTest {
16 public: 17 public:
17 InterstitialUITest() {} 18 InterstitialUITest() {}
18 ~InterstitialUITest() override {} 19 ~InterstitialUITest() override {}
19 20
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 IN_PROC_BROWSER_TEST_F(InterstitialUITest, CaptivePortalInterstitial) { 79 IN_PROC_BROWSER_TEST_F(InterstitialUITest, CaptivePortalInterstitial) {
79 TestInterstitial(GURL("chrome://interstitials/captiveportal"), 80 TestInterstitial(GURL("chrome://interstitials/captiveportal"),
80 "Connect to network"); 81 "Connect to network");
81 } 82 }
82 83
83 IN_PROC_BROWSER_TEST_F(InterstitialUITest, CaptivePortalInterstitialWifi) { 84 IN_PROC_BROWSER_TEST_F(InterstitialUITest, CaptivePortalInterstitialWifi) {
84 TestInterstitial(GURL("chrome://interstitials/captiveportal?is_wifi=1"), 85 TestInterstitial(GURL("chrome://interstitials/captiveportal?is_wifi=1"),
85 "Connect to Wi-Fi"); 86 "Connect to Wi-Fi");
86 } 87 }
88
89 // Checks that the interstitial page uses correct web contents. If not, closing
90 // the tab might result in a freed web contents pointer and cause a crash.
91 // See https://crbug.com/611706 for details.
92 IN_PROC_BROWSER_TEST_F(InterstitialUITest, UseCorrectWebContents) {
93 int current_tab = browser()->tab_strip_model()->active_index();
94 ui_test_utils::NavigateToURL(browser(), GURL("chrome://interstitials/ssl"));
95
96 // Duplicate the tab and close it.
97 chrome::DuplicateTab(browser());
98 EXPECT_NE(current_tab, browser()->tab_strip_model()->active_index());
99 chrome::CloseTab(browser());
100 EXPECT_EQ(current_tab, browser()->tab_strip_model()->active_index());
101
102 // Reloading the page shouldn't cause a crash.
103 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
104 }
OLDNEW
« 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