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

Unified Diff: chrome/browser/net/net_error_tab_helper_unittest.cc

Issue 2574953002: Fix Android unit_tests failures with PlzNavigate. (Closed)
Patch Set: fix last test and cleanup Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/net_error_tab_helper_unittest.cc
diff --git a/chrome/browser/net/net_error_tab_helper_unittest.cc b/chrome/browser/net/net_error_tab_helper_unittest.cc
index 5dcf9f168dfc044df314eaa33dd632056db8f8d3..daab84b5c63a8e8eb4b26c42b6068db2cff687fb 100644
--- a/chrome/browser/net/net_error_tab_helper_unittest.cc
+++ b/chrome/browser/net/net_error_tab_helper_unittest.cc
@@ -169,6 +169,16 @@ class NetErrorTabHelperTest : public ChromeRenderViewHostTestHarness {
}
}
+#if BUILDFLAG(ANDROID_JAVA_UI)
+ void NoDownloadPageLaterForNonHttpSchemes(const char* url_string,
+ bool succeeded) {
+ GURL url(url_string);
+ LoadURL(url, succeeded);
+ tab_helper()->DownloadPageLater();
+ EXPECT_EQ(0, tab_helper()->times_download_page_later_invoked());
+ }
+#endif
+
bool probe_running() { return tab_helper_->mock_probe_running(); }
DnsProbeStatus last_status_sent() { return tab_helper_->last_status_sent(); }
int sent_count() { return tab_helper_->mock_sent_count(); }
@@ -379,18 +389,21 @@ TEST_F(NetErrorTabHelperTest, NoDownloadPageLaterOnNonErrorPage) {
// Makes sure that "Download page later" isn't run on URLs with non-HTTP/HTTPS
// schemes.
-TEST_F(NetErrorTabHelperTest, NoDownloadPageLaterForNonHttpSchemes) {
- const char* kUrls[] = {
- "file:///blah/blah",
- "chrome://blah/",
- "about:blank",
- };
+// NOTE: the test harness code in this file and in TestRendererHost don't always
+// deal with pending RFH correctly. This works because most tests only load
+// once. So workaround it by puting each test case in a separate test.
arthursonzogni 2016/12/15 16:32:39 Nit: s/don't/doesn't Nit: s/puting/putting
+TEST_F(NetErrorTabHelperTest, NoDownloadPageLaterForNonHttpSchemes1) {
+ NoDownloadPageLaterForNonHttpSchemes("file:///blah/blah", false);
+}
- for (const char* url_string : kUrls) {
- GURL url(url_string);
- LoadURL(url, false /*succeeded*/);
- tab_helper()->DownloadPageLater();
- EXPECT_EQ(0, tab_helper()->times_download_page_later_invoked());
- }
+TEST_F(NetErrorTabHelperTest, NoDownloadPageLaterForNonHttpSchemes2) {
+ NoDownloadPageLaterForNonHttpSchemes("chrome://blah/", false);
+}
+
+TEST_F(NetErrorTabHelperTest, NoDownloadPageLaterForNonHttpSchemes3) {
+ // about:blank always succeeds, and the test harness won't handle URLs that
+ // don't go to the network failing.
+ NoDownloadPageLaterForNonHttpSchemes("about:blank", true);
}
+
#endif // BUILDFLAG(ANDROID_JAVA_UI)
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698