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

Side by Side Diff: content/browser/browser_side_navigation_browsertest.cc

Issue 2889703002: Ensure that all code paths which call FrameTreeNode::ResetNavigationRequest set NavigationHandle::G… (Closed)
Patch Set: review comments Created 3 years, 7 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/cross_site_transfer_browsertest.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 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/frame_host/navigation_handle_impl.h" 10 #include "content/browser/frame_host/navigation_handle_impl.h"
11 #include "content/browser/frame_host/navigation_request.h" 11 #include "content/browser/frame_host/navigation_request.h"
12 #include "content/browser/web_contents/web_contents_impl.h" 12 #include "content/browser/web_contents/web_contents_impl.h"
13 #include "content/common/site_isolation_policy.h" 13 #include "content/common/site_isolation_policy.h"
14 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/public/common/content_switches.h" 16 #include "content/public/common/content_switches.h"
17 #include "content/public/common/url_constants.h" 17 #include "content/public/common/url_constants.h"
18 #include "content/public/test/browser_test_utils.h" 18 #include "content/public/test/browser_test_utils.h"
19 #include "content/public/test/content_browser_test.h" 19 #include "content/public/test/content_browser_test.h"
20 #include "content/public/test/content_browser_test_utils.h" 20 #include "content/public/test/content_browser_test_utils.h"
21 #include "content/public/test/navigation_handle_observer.h"
21 #include "content/public/test/test_navigation_observer.h" 22 #include "content/public/test/test_navigation_observer.h"
22 #include "content/shell/browser/shell.h" 23 #include "content/shell/browser/shell.h"
23 #include "content/shell/browser/shell_network_delegate.h" 24 #include "content/shell/browser/shell_network_delegate.h"
24 #include "net/dns/mock_host_resolver.h" 25 #include "net/dns/mock_host_resolver.h"
25 #include "net/test/embedded_test_server/embedded_test_server.h" 26 #include "net/test/embedded_test_server/embedded_test_server.h"
26 #include "net/test/url_request/url_request_failed_job.h" 27 #include "net/test/url_request/url_request_failed_job.h"
27 #include "url/gurl.h" 28 #include "url/gurl.h"
28 29
29 namespace content { 30 namespace content {
30 31
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 ->IsViewSourceMode()); 276 ->IsViewSourceMode());
276 } 277 }
277 278
278 // Ensure that closing a page by running its beforeunload handler doesn't hang 279 // Ensure that closing a page by running its beforeunload handler doesn't hang
279 // if there's an ongoing navigation. 280 // if there's an ongoing navigation.
280 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, 281 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest,
281 UnloadDuringNavigation) { 282 UnloadDuringNavigation) {
282 content::WindowedNotificationObserver close_observer( 283 content::WindowedNotificationObserver close_observer(
283 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 284 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
284 content::Source<content::WebContents>(shell()->web_contents())); 285 content::Source<content::WebContents>(shell()->web_contents()));
285 shell()->LoadURL(GURL("chrome://resources/css/tabs.css")); 286 GURL url("chrome://resources/css/tabs.css");
287 NavigationHandleObserver handle_observer(shell()->web_contents(), url);
288 shell()->LoadURL(url);
286 shell()->web_contents()->DispatchBeforeUnload(); 289 shell()->web_contents()->DispatchBeforeUnload();
287 close_observer.Wait(); 290 close_observer.Wait();
291 EXPECT_EQ(net::ERR_ABORTED, handle_observer.net_error_code());
288 } 292 }
289 293
290 // Ensure that the referrer of a navigation is properly sanitized. 294 // Ensure that the referrer of a navigation is properly sanitized.
291 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, SanitizeReferrer) { 295 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, SanitizeReferrer) {
292 const GURL kInsecureUrl(embedded_test_server()->GetURL("/title1.html")); 296 const GURL kInsecureUrl(embedded_test_server()->GetURL("/title1.html"));
293 const Referrer kSecureReferrer( 297 const Referrer kSecureReferrer(
294 GURL("https://secure-url.com"), 298 GURL("https://secure-url.com"),
295 blink::kWebReferrerPolicyNoReferrerWhenDowngrade); 299 blink::kWebReferrerPolicyNoReferrerWhenDowngrade);
296 ShellNetworkDelegate::SetCancelURLRequestWithPolicyViolatingReferrerHeader( 300 ShellNetworkDelegate::SetCancelURLRequestWithPolicyViolatingReferrerHeader(
297 true); 301 true);
(...skipping 14 matching lines...) Expand all
312 EXPECT_EQ(GURL(), 316 EXPECT_EQ(GURL(),
313 root->navigation_request()->navigation_handle()->GetReferrer().url); 317 root->navigation_request()->navigation_handle()->GetReferrer().url);
314 318
315 // The navigation should commit without being blocked. 319 // The navigation should commit without being blocked.
316 EXPECT_TRUE(manager.WaitForResponse()); 320 EXPECT_TRUE(manager.WaitForResponse());
317 manager.WaitForNavigationFinished(); 321 manager.WaitForNavigationFinished();
318 EXPECT_EQ(kInsecureUrl, shell()->web_contents()->GetLastCommittedURL()); 322 EXPECT_EQ(kInsecureUrl, shell()->web_contents()->GetLastCommittedURL());
319 } 323 }
320 324
321 } // namespace content 325 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/cross_site_transfer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698