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

Side by Side Diff: content/browser/web_contents/web_contents_impl_browsertest.cc

Issue 2132603002: [page_load_metrics] Add a NavigationThrottle for richer abort metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nasko@ nits Created 4 years, 4 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
OLDNEW
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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 const GURL kCrossSiteURL( 915 const GURL kCrossSiteURL(
916 embedded_test_server()->GetURL("bar.com", "/title1.html")); 916 embedded_test_server()->GetURL("bar.com", "/title1.html"));
917 917
918 // Navigate to a first web page with a BeforeUnload event listener. 918 // Navigate to a first web page with a BeforeUnload event listener.
919 EXPECT_TRUE(NavigateToURL(shell(), kStartURL)); 919 EXPECT_TRUE(NavigateToURL(shell(), kStartURL));
920 920
921 // Start a cross-site navigation that will not commit for the moment. 921 // Start a cross-site navigation that will not commit for the moment.
922 TestNavigationManager cross_site_delayer(shell()->web_contents(), 922 TestNavigationManager cross_site_delayer(shell()->web_contents(),
923 kCrossSiteURL); 923 kCrossSiteURL);
924 shell()->LoadURL(kCrossSiteURL); 924 shell()->LoadURL(kCrossSiteURL);
925 cross_site_delayer.WaitForWillStartRequest(); 925 EXPECT_TRUE(cross_site_delayer.WaitForWillStartRequest());
926 926
927 // Click on a link in the page. This will show the BeforeUnload dialog. 927 // Click on a link in the page. This will show the BeforeUnload dialog.
928 // Ensure the dialog is not dismissed, which will cause it to still be 928 // Ensure the dialog is not dismissed, which will cause it to still be
929 // present when the cross-site navigation later commits. 929 // present when the cross-site navigation later commits.
930 // Note: the javascript function executed will not do the link click but 930 // Note: the javascript function executed will not do the link click but
931 // schedule it for afterwards. Since the BeforeUnload event is synchronous, 931 // schedule it for afterwards. Since the BeforeUnload event is synchronous,
932 // clicking on the link right away would cause the ExecuteScript to never 932 // clicking on the link right away would cause the ExecuteScript to never
933 // return. 933 // return.
934 SetShouldProceedOnBeforeUnload(shell(), false); 934 SetShouldProceedOnBeforeUnload(shell(), false);
935 EXPECT_TRUE(ExecuteScript(shell(), "clickLinkSoon()")); 935 EXPECT_TRUE(ExecuteScript(shell(), "clickLinkSoon()"));
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 shell()->LoadURL(GURL("about:blank")); 1243 shell()->LoadURL(GURL("about:blank"));
1244 base::RunLoop run_loop; 1244 base::RunLoop run_loop;
1245 shell()->web_contents()->DownloadImage( 1245 shell()->web_contents()->DownloadImage(
1246 kImageUrl, false, 2, false, 1246 kImageUrl, false, 2, false,
1247 base::Bind(&ExpectNoValidImageCallback, run_loop.QuitClosure())); 1247 base::Bind(&ExpectNoValidImageCallback, run_loop.QuitClosure()));
1248 1248
1249 run_loop.Run(); 1249 run_loop.Run();
1250 } 1250 }
1251 1251
1252 } // namespace content 1252 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl_browsertest.cc ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698