OLD | NEW |
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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 GURL test_url("http://error.page.auto.reload"); | 934 GURL test_url("http://error.page.auto.reload"); |
935 const int kRequestsToFail = 3; | 935 const int kRequestsToFail = 3; |
936 InstallInterceptor(test_url, kRequestsToFail); | 936 InstallInterceptor(test_url, kRequestsToFail); |
937 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 937 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
938 browser(), test_url, 2); | 938 browser(), test_url, 2); |
939 | 939 |
940 EXPECT_EQ(2, interceptor()->failures()); | 940 EXPECT_EQ(2, interceptor()->failures()); |
941 EXPECT_EQ(2, interceptor()->requests()); | 941 EXPECT_EQ(2, interceptor()->requests()); |
942 | 942 |
943 ToggleHelpBox(browser()); | 943 ToggleHelpBox(browser()); |
944 EXPECT_TRUE(IsDisplayingNetError(browser(), net::ERR_CONNECTION_RESET)); | 944 EXPECT_TRUE(IsDisplayingText(browser(), "error.page.auto.reload")); |
945 | 945 |
946 content::WebContents* web_contents = | 946 content::WebContents* web_contents = |
947 browser()->tab_strip_model()->GetActiveWebContents(); | 947 browser()->tab_strip_model()->GetActiveWebContents(); |
948 content::TestNavigationObserver nav_observer(web_contents, 1); | 948 content::TestNavigationObserver nav_observer(web_contents, 1); |
949 web_contents->GetMainFrame()->ExecuteJavaScript( | 949 web_contents->GetMainFrame()->ExecuteJavaScript( |
950 base::ASCIIToUTF16("document.getElementById('reload-button').click();")); | 950 base::ASCIIToUTF16("document.getElementById('reload-button').click();")); |
951 nav_observer.Wait(); | 951 nav_observer.Wait(); |
952 EXPECT_FALSE(IsDisplayingNetError(browser(), net::ERR_CONNECTION_RESET)); | 952 EXPECT_FALSE(IsDisplayingText(browser(), "error.page.auto.reload")); |
953 } | 953 } |
954 | 954 |
955 // Interceptor that fails all requests with net::ERR_ADDRESS_UNREACHABLE. | 955 // Interceptor that fails all requests with net::ERR_ADDRESS_UNREACHABLE. |
956 class AddressUnreachableInterceptor : public net::URLRequestInterceptor { | 956 class AddressUnreachableInterceptor : public net::URLRequestInterceptor { |
957 public: | 957 public: |
958 AddressUnreachableInterceptor() {} | 958 AddressUnreachableInterceptor() {} |
959 ~AddressUnreachableInterceptor() override {} | 959 ~AddressUnreachableInterceptor() override {} |
960 | 960 |
961 // net::URLRequestInterceptor: | 961 // net::URLRequestInterceptor: |
962 net::URLRequestJob* MaybeInterceptRequest( | 962 net::URLRequestJob* MaybeInterceptRequest( |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 ui_test_utils::NavigateToURL( | 1117 ui_test_utils::NavigateToURL( |
1118 browser(), | 1118 browser(), |
1119 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, | 1119 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, |
1120 kHostname)); | 1120 kHostname)); |
1121 | 1121 |
1122 ToggleHelpBox(browser()); | 1122 ToggleHelpBox(browser()); |
1123 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode)); | 1123 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode)); |
1124 } | 1124 } |
1125 | 1125 |
1126 } // namespace | 1126 } // namespace |
OLD | NEW |