OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "content/browser/frame_host/navigation_entry_impl.h" | 10 #include "content/browser/frame_host/navigation_entry_impl.h" |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 const GURL kCrossSiteURL( | 916 const GURL kCrossSiteURL( |
917 embedded_test_server()->GetURL("bar.com", "/title1.html")); | 917 embedded_test_server()->GetURL("bar.com", "/title1.html")); |
918 | 918 |
919 // Navigate to a first web page with a BeforeUnload event listener. | 919 // Navigate to a first web page with a BeforeUnload event listener. |
920 EXPECT_TRUE(NavigateToURL(shell(), kStartURL)); | 920 EXPECT_TRUE(NavigateToURL(shell(), kStartURL)); |
921 | 921 |
922 // Start a cross-site navigation that will not commit for the moment. | 922 // Start a cross-site navigation that will not commit for the moment. |
923 TestNavigationManager cross_site_delayer(shell()->web_contents(), | 923 TestNavigationManager cross_site_delayer(shell()->web_contents(), |
924 kCrossSiteURL); | 924 kCrossSiteURL); |
925 shell()->LoadURL(kCrossSiteURL); | 925 shell()->LoadURL(kCrossSiteURL); |
926 EXPECT_TRUE(cross_site_delayer.WaitForWillStartRequest()); | 926 EXPECT_TRUE(cross_site_delayer.WaitForRequestStart()); |
927 | 927 |
928 // Click on a link in the page. This will show the BeforeUnload dialog. | 928 // Click on a link in the page. This will show the BeforeUnload dialog. |
929 // Ensure the dialog is not dismissed, which will cause it to still be | 929 // Ensure the dialog is not dismissed, which will cause it to still be |
930 // present when the cross-site navigation later commits. | 930 // present when the cross-site navigation later commits. |
931 // Note: the javascript function executed will not do the link click but | 931 // Note: the javascript function executed will not do the link click but |
932 // schedule it for afterwards. Since the BeforeUnload event is synchronous, | 932 // schedule it for afterwards. Since the BeforeUnload event is synchronous, |
933 // clicking on the link right away would cause the ExecuteScript to never | 933 // clicking on the link right away would cause the ExecuteScript to never |
934 // return. | 934 // return. |
935 SetShouldProceedOnBeforeUnload(shell(), false); | 935 SetShouldProceedOnBeforeUnload(shell(), false); |
936 EXPECT_TRUE(ExecuteScript(shell(), "clickLinkSoon()")); | 936 EXPECT_TRUE(ExecuteScript(shell(), "clickLinkSoon()")); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 shell()->LoadURL(GURL("about:blank")); | 1244 shell()->LoadURL(GURL("about:blank")); |
1245 base::RunLoop run_loop; | 1245 base::RunLoop run_loop; |
1246 shell()->web_contents()->DownloadImage( | 1246 shell()->web_contents()->DownloadImage( |
1247 kImageUrl, false, 2, false, | 1247 kImageUrl, false, 2, false, |
1248 base::Bind(&ExpectNoValidImageCallback, run_loop.QuitClosure())); | 1248 base::Bind(&ExpectNoValidImageCallback, run_loop.QuitClosure())); |
1249 | 1249 |
1250 run_loop.Run(); | 1250 run_loop.Run(); |
1251 } | 1251 } |
1252 | 1252 |
1253 } // namespace content | 1253 } // namespace content |
OLD | NEW |