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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 enum HistoryNavigationDirection { | 290 enum HistoryNavigationDirection { |
291 HISTORY_NAVIGATE_BACK, | 291 HISTORY_NAVIGATE_BACK, |
292 HISTORY_NAVIGATE_FORWARD, | 292 HISTORY_NAVIGATE_FORWARD, |
293 }; | 293 }; |
294 | 294 |
295 ErrorPageTest() : link_doctor_interceptor_(NULL) {} | 295 ErrorPageTest() : link_doctor_interceptor_(NULL) {} |
296 ~ErrorPageTest() override {} | 296 ~ErrorPageTest() override {} |
297 | 297 |
298 // Navigates the active tab to a mock url created for the file at |file_path|. | 298 // Navigates the active tab to a mock url created for the file at |file_path|. |
299 // Needed for StaleCacheStatus and StaleCacheStatusFailedCorrections tests. | 299 // Needed for StaleCacheStatus and StaleCacheStatusFailedCorrections tests. |
300 void SetUpCommandLine(CommandLine* command_line) override { | 300 void SetUpCommandLine(base::CommandLine* command_line) override { |
301 command_line->AppendSwitch(switches::kEnableOfflineLoadStaleCache); | 301 command_line->AppendSwitch(switches::kEnableOfflineLoadStaleCache); |
302 } | 302 } |
303 | 303 |
304 // Navigates the active tab to a mock url created for the file at |file_path|. | 304 // Navigates the active tab to a mock url created for the file at |file_path|. |
305 void NavigateToFileURL(const base::FilePath::StringType& file_path) { | 305 void NavigateToFileURL(const base::FilePath::StringType& file_path) { |
306 ui_test_utils::NavigateToURL( | 306 ui_test_utils::NavigateToURL( |
307 browser(), | 307 browser(), |
308 net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(file_path))); | 308 net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(file_path))); |
309 } | 309 } |
310 | 310 |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 remover->Remove(BrowsingDataRemover::REMOVE_CACHE, | 867 remover->Remove(BrowsingDataRemover::REMOVE_CACHE, |
868 BrowsingDataHelper::UNPROTECTED_WEB); | 868 BrowsingDataHelper::UNPROTECTED_WEB); |
869 ui_test_utils::NavigateToURL(browser(), test_url); | 869 ui_test_utils::NavigateToURL(browser(), test_url); |
870 EXPECT_TRUE(ProbeStaleCopyValue(false)); | 870 EXPECT_TRUE(ProbeStaleCopyValue(false)); |
871 EXPECT_FALSE(IsDisplayingText(browser(), GetLoadStaleButtonLabel())); | 871 EXPECT_FALSE(IsDisplayingText(browser(), GetLoadStaleButtonLabel())); |
872 EXPECT_EQ(0, link_doctor_interceptor()->num_requests()); | 872 EXPECT_EQ(0, link_doctor_interceptor()->num_requests()); |
873 } | 873 } |
874 | 874 |
875 class ErrorPageAutoReloadTest : public InProcessBrowserTest { | 875 class ErrorPageAutoReloadTest : public InProcessBrowserTest { |
876 public: | 876 public: |
877 void SetUpCommandLine(CommandLine* command_line) override { | 877 void SetUpCommandLine(base::CommandLine* command_line) override { |
878 command_line->AppendSwitch(switches::kEnableOfflineAutoReload); | 878 command_line->AppendSwitch(switches::kEnableOfflineAutoReload); |
879 } | 879 } |
880 | 880 |
881 void InstallInterceptor(const GURL& url, int requests_to_fail) { | 881 void InstallInterceptor(const GURL& url, int requests_to_fail) { |
882 interceptor_ = new FailFirstNRequestsInterceptor(requests_to_fail); | 882 interceptor_ = new FailFirstNRequestsInterceptor(requests_to_fail); |
883 scoped_ptr<net::URLRequestInterceptor> owned_interceptor(interceptor_); | 883 scoped_ptr<net::URLRequestInterceptor> owned_interceptor(interceptor_); |
884 | 884 |
885 // Tests don't need to wait for this task to complete before using the | 885 // Tests don't need to wait for this task to complete before using the |
886 // filter; any requests that might be affected by it will end up in the IO | 886 // filter; any requests that might be affected by it will end up in the IO |
887 // thread's message loop after this posted task anyway. | 887 // thread's message loop after this posted task anyway. |
(...skipping 229 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 |