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

Side by Side Diff: chrome/browser/crash_recovery_browsertest.cc

Issue 2423243002: Fix regression where navigating to debug URLs didn't update the omnibox. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 5 #include <utility>
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_commands.h" 14 #include "chrome/browser/ui/browser_commands.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
18 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/browser/navigation_controller.h"
20 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
21 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
22 #include "content/public/test/browser_test_utils.h" 24 #include "content/public/test/browser_test_utils.h"
23 #include "net/test/embedded_test_server/embedded_test_server.h" 25 #include "net/test/embedded_test_server/embedded_test_server.h"
24 #include "net/test/embedded_test_server/http_request.h" 26 #include "net/test/embedded_test_server/http_request.h"
25 #include "net/test/embedded_test_server/http_response.h" 27 #include "net/test/embedded_test_server/http_response.h"
26 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
27 #include "ui/base/page_transition_types.h" 29 #include "ui/base/page_transition_types.h"
28 30
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 135 }
134 136
135 // Tests that loading a crashed page in a new tab correctly updates the title. 137 // Tests that loading a crashed page in a new tab correctly updates the title.
136 // There was an earlier bug (1270510) in process-per-site in which the max page 138 // There was an earlier bug (1270510) in process-per-site in which the max page
137 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab 139 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab
138 // was not committed. This prevents regression of that bug. 140 // was not committed. This prevents regression of that bug.
139 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { 141 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) {
140 const base::FilePath::CharType kTitle2File[] = 142 const base::FilePath::CharType kTitle2File[] =
141 FILE_PATH_LITERAL("title2.html"); 143 FILE_PATH_LITERAL("title2.html");
142 144
143 ui_test_utils::NavigateToURL( 145 GURL url(ui_test_utils::GetTestUrl(
144 browser(), ui_test_utils::GetTestUrl( 146 base::FilePath(base::FilePath::kCurrentDirectory),
145 base::FilePath(base::FilePath::kCurrentDirectory), 147 base::FilePath(kTitle2File)));
146 base::FilePath(kTitle2File))); 148 ui_test_utils::NavigateToURL(browser(), url);
147 149
148 base::string16 title_before_crash; 150 base::string16 title_before_crash;
149 base::string16 title_after_crash; 151 base::string16 title_after_crash;
150 152
151 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), 153 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(),
152 &title_before_crash)); 154 &title_before_crash));
153 SimulateRendererCrash(browser()); 155 SimulateRendererCrash(browser());
156 ASSERT_EQ(GURL(content::kChromeUICrashURL),
157 GetActiveWebContents()->GetController().GetVisibleEntry()->
158 GetVirtualURL());
154 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); 159 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
155 content::WaitForLoadStop(GetActiveWebContents()); 160 content::WaitForLoadStop(GetActiveWebContents());
156 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), 161 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(),
157 &title_after_crash)); 162 &title_after_crash));
158 EXPECT_EQ(title_before_crash, title_after_crash); 163 EXPECT_EQ(title_before_crash, title_after_crash);
159 } 164 }
160 165
161 // Tests that reloads of navigation errors behave correctly after a crash. 166 // Tests that reloads of navigation errors behave correctly after a crash.
162 // Regression test for http://crbug.com/348918 167 // Regression test for http://crbug.com/348918
163 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, DoubleReloadWithError) { 168 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, DoubleReloadWithError) {
(...skipping 20 matching lines...) Expand all
184 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" 189 "<script>window.onbeforeunload=function(e){return 'foo'}</script>"
185 "</body></html>"; 190 "</body></html>";
186 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); 191 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML);
187 ui_test_utils::NavigateToURL(browser(), url); 192 ui_test_utils::NavigateToURL(browser(), url);
188 SimulateRendererCrash(browser()); 193 SimulateRendererCrash(browser());
189 } 194 }
190 195
191 } // namespace 196 } // namespace
192 197
193 #endif 198 #endif
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698