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

Side by Side Diff: chrome/browser/errorpage_browsertest.cc

Issue 1378123003: Adding SSL ETS Tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ets
Patch Set: Rebase. Created 5 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 26 matching lines...) Expand all
37 #include "content/public/browser/render_view_host.h" 37 #include "content/public/browser/render_view_host.h"
38 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
39 #include "content/public/browser/web_contents_observer.h" 39 #include "content/public/browser/web_contents_observer.h"
40 #include "content/public/test/browser_test_utils.h" 40 #include "content/public/test/browser_test_utils.h"
41 #include "content/public/test/test_navigation_observer.h" 41 #include "content/public/test/test_navigation_observer.h"
42 #include "net/base/filename_util.h" 42 #include "net/base/filename_util.h"
43 #include "net/base/net_errors.h" 43 #include "net/base/net_errors.h"
44 #include "net/base/net_util.h" 44 #include "net/base/net_util.h"
45 #include "net/http/failing_http_transaction_factory.h" 45 #include "net/http/failing_http_transaction_factory.h"
46 #include "net/http/http_cache.h" 46 #include "net/http/http_cache.h"
47 #include "net/test/spawned_test_server/spawned_test_server.h"
48 #include "net/test/url_request/url_request_failed_job.h" 47 #include "net/test/url_request/url_request_failed_job.h"
49 #include "net/test/url_request/url_request_mock_http_job.h" 48 #include "net/test/url_request/url_request_mock_http_job.h"
50 #include "net/url_request/url_request_context.h" 49 #include "net/url_request/url_request_context.h"
51 #include "net/url_request/url_request_context_getter.h" 50 #include "net/url_request/url_request_context_getter.h"
52 #include "net/url_request/url_request_filter.h" 51 #include "net/url_request/url_request_filter.h"
53 #include "net/url_request/url_request_interceptor.h" 52 #include "net/url_request/url_request_interceptor.h"
54 #include "net/url_request/url_request_job.h" 53 #include "net/url_request/url_request_job.h"
55 #include "net/url_request/url_request_test_job.h" 54 #include "net/url_request/url_request_test_job.h"
56 #include "net/url_request/url_request_test_util.h" 55 #include "net/url_request/url_request_test_util.h"
57 #include "policy/policy_constants.h" 56 #include "policy/policy_constants.h"
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 IN_PROC_BROWSER_TEST_F(ErrorPageTest, Page404) { 894 IN_PROC_BROWSER_TEST_F(ErrorPageTest, Page404) {
896 NavigateToURLAndWaitForTitle( 895 NavigateToURLAndWaitForTitle(
897 net::URLRequestMockHTTPJob::GetMockUrl("page404.html"), "SUCCESS", 1); 896 net::URLRequestMockHTTPJob::GetMockUrl("page404.html"), "SUCCESS", 1);
898 EXPECT_EQ(0, link_doctor_interceptor()->num_requests()); 897 EXPECT_EQ(0, link_doctor_interceptor()->num_requests());
899 } 898 }
900 899
901 // Checks that when an error occurs, the stale cache status of the page 900 // Checks that when an error occurs, the stale cache status of the page
902 // is correctly transferred, and that stale cached copied can be loaded 901 // is correctly transferred, and that stale cached copied can be loaded
903 // from the javascript. 902 // from the javascript.
904 IN_PROC_BROWSER_TEST_F(ErrorPageTest, StaleCacheStatus) { 903 IN_PROC_BROWSER_TEST_F(ErrorPageTest, StaleCacheStatus) {
905 ASSERT_TRUE(test_server()->Start()); 904 ASSERT_TRUE(embedded_test_server()->Start());
906 // Load cache with entry with "nocache" set, to create stale 905 // Load cache with entry with "nocache" set, to create stale
907 // cache. 906 // cache.
908 GURL test_url(test_server()->GetURL("files/nocache.html")); 907 GURL test_url(embedded_test_server()->GetURL("/nocache.html"));
909 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1); 908 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1);
910 909
911 // Reload same URL after forcing an error from the the network layer; 910 // Reload same URL after forcing an error from the the network layer;
912 // confirm that the error page is told the cached copy exists. 911 // confirm that the error page is told the cached copy exists.
913 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = 912 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter =
914 browser()->profile()->GetRequestContext(); 913 browser()->profile()->GetRequestContext();
915 BrowserThread::PostTask( 914 BrowserThread::PostTask(
916 BrowserThread::IO, FROM_HERE, 915 BrowserThread::IO, FROM_HERE,
917 base::Bind(&InterceptNetworkTransactions, url_request_context_getter, 916 base::Bind(&InterceptNetworkTransactions, url_request_context_getter,
918 net::ERR_FAILED)); 917 net::ERR_FAILED));
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 EXPECT_EQ(PlatformSupportsDiagnosticsTool(), 1137 EXPECT_EQ(PlatformSupportsDiagnosticsTool(),
1139 IsDisplayingDiagnosticsButton(browser())); 1138 IsDisplayingDiagnosticsButton(browser()));
1140 } 1139 }
1141 1140
1142 // Checks that when an error occurs and a corrections fail to load, the stale 1141 // Checks that when an error occurs and a corrections fail to load, the stale
1143 // cache status of the page is correctly transferred, and we can load the 1142 // cache status of the page is correctly transferred, and we can load the
1144 // stale copy from the javascript. Most logic copied from StaleCacheStatus 1143 // stale copy from the javascript. Most logic copied from StaleCacheStatus
1145 // above. 1144 // above.
1146 IN_PROC_BROWSER_TEST_F(ErrorPageNavigationCorrectionsFailTest, 1145 IN_PROC_BROWSER_TEST_F(ErrorPageNavigationCorrectionsFailTest,
1147 StaleCacheStatusFailedCorrections) { 1146 StaleCacheStatusFailedCorrections) {
1148 ASSERT_TRUE(test_server()->Start()); 1147 ASSERT_TRUE(embedded_test_server()->Start());
1149 // Load cache with entry with "nocache" set, to create stale 1148 // Load cache with entry with "nocache" set, to create stale
1150 // cache. 1149 // cache.
1151 GURL test_url(test_server()->GetURL("files/nocache.html")); 1150 GURL test_url(embedded_test_server()->GetURL("/nocache.html"));
1152 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1); 1151 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1);
1153 1152
1154 // Reload same URL after forcing an error from the the network layer; 1153 // Reload same URL after forcing an error from the the network layer;
1155 // confirm that the error page is told the cached copy exists. 1154 // confirm that the error page is told the cached copy exists.
1156 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = 1155 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter =
1157 browser()->profile()->GetRequestContext(); 1156 browser()->profile()->GetRequestContext();
1158 BrowserThread::PostTask( 1157 BrowserThread::PostTask(
1159 BrowserThread::IO, FROM_HERE, 1158 BrowserThread::IO, FROM_HERE,
1160 base::Bind(&InterceptNetworkTransactions, url_request_context_getter, 1159 base::Bind(&InterceptNetworkTransactions, url_request_context_getter,
1161 net::ERR_CONNECTION_FAILED)); 1160 net::ERR_CONNECTION_FAILED));
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 ui_test_utils::NavigateToURL( 1385 ui_test_utils::NavigateToURL(
1387 browser(), 1386 browser(),
1388 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, 1387 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT,
1389 kHostname)); 1388 kHostname));
1390 1389
1391 ToggleHelpBox(browser()); 1390 ToggleHelpBox(browser());
1392 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode)); 1391 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode));
1393 } 1392 }
1394 1393
1395 } // namespace 1394 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/save_page_browsertest.cc ('k') | chrome/browser/extensions/active_script_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698