| OLD | NEW |
| 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" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 ->IsViewSourceMode()); | 275 ->IsViewSourceMode()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 // Ensure that closing a page by running its beforeunload handler doesn't hang | 278 // Ensure that closing a page by running its beforeunload handler doesn't hang |
| 279 // if there's an ongoing navigation. | 279 // if there's an ongoing navigation. |
| 280 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, | 280 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, |
| 281 UnloadDuringNavigation) { | 281 UnloadDuringNavigation) { |
| 282 content::WindowedNotificationObserver close_observer( | 282 content::WindowedNotificationObserver close_observer( |
| 283 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 283 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 284 content::Source<content::WebContents>(shell()->web_contents())); | 284 content::Source<content::WebContents>(shell()->web_contents())); |
| 285 GURL url( | |
| 286 "data:text/html,<html><script>window.onbeforeunload=function(e)" | |
| 287 "{}</script></html>"); | |
| 288 NavigateToURL(shell(), url); | |
| 289 shell()->LoadURL(GURL("chrome://resources/css/tabs.css")); | 285 shell()->LoadURL(GURL("chrome://resources/css/tabs.css")); |
| 290 shell()->web_contents()->DispatchBeforeUnload(); | 286 shell()->web_contents()->DispatchBeforeUnload(); |
| 291 close_observer.Wait(); | 287 close_observer.Wait(); |
| 292 } | 288 } |
| 293 | 289 |
| 294 // Ensure that the referrer of a navigation is properly sanitized. | 290 // Ensure that the referrer of a navigation is properly sanitized. |
| 295 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, SanitizeReferrer) { | 291 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, SanitizeReferrer) { |
| 296 const GURL kInsecureUrl(embedded_test_server()->GetURL("/title1.html")); | 292 const GURL kInsecureUrl(embedded_test_server()->GetURL("/title1.html")); |
| 297 const Referrer kSecureReferrer( | 293 const Referrer kSecureReferrer( |
| 298 GURL("https://secure-url.com"), | 294 GURL("https://secure-url.com"), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 316 EXPECT_EQ(GURL(), | 312 EXPECT_EQ(GURL(), |
| 317 root->navigation_request()->navigation_handle()->GetReferrer().url); | 313 root->navigation_request()->navigation_handle()->GetReferrer().url); |
| 318 | 314 |
| 319 // The navigation should commit without being blocked. | 315 // The navigation should commit without being blocked. |
| 320 EXPECT_TRUE(manager.WaitForResponse()); | 316 EXPECT_TRUE(manager.WaitForResponse()); |
| 321 manager.WaitForNavigationFinished(); | 317 manager.WaitForNavigationFinished(); |
| 322 EXPECT_EQ(kInsecureUrl, shell()->web_contents()->GetLastCommittedURL()); | 318 EXPECT_EQ(kInsecureUrl, shell()->web_contents()->GetLastCommittedURL()); |
| 323 } | 319 } |
| 324 | 320 |
| 325 } // namespace content | 321 } // namespace content |
| OLD | NEW |