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 <deque> | 5 #include <deque> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 return new HangingURLRequestJob(request, network_delegate); | 818 return new HangingURLRequestJob(request, network_delegate); |
819 } | 819 } |
820 return new net::URLRequestMockHTTPJob( | 820 return new net::URLRequestMockHTTPJob( |
821 request, | 821 request, |
822 network_delegate, | 822 network_delegate, |
823 file_, | 823 file_, |
824 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 824 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
825 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 825 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
826 } | 826 } |
827 | 827 |
| 828 net::URLRequestJob* MaybeInterceptResponse( |
| 829 net::URLRequest* request, |
| 830 net::NetworkDelegate* network_delegate) const override { |
| 831 return NULL; |
| 832 } |
| 833 |
| 834 net::URLRequestJob* MaybeInterceptRedirect( |
| 835 net::URLRequest* request, |
| 836 net::NetworkDelegate* network_delegate, |
| 837 const GURL& location) const override { |
| 838 return NULL; |
| 839 } |
| 840 |
828 private: | 841 private: |
829 base::FilePath file_; | 842 base::FilePath file_; |
830 base::Closure callback_; | 843 base::Closure callback_; |
831 mutable bool first_run_; | 844 mutable bool first_run_; |
832 }; | 845 }; |
833 | 846 |
834 // Makes |url| never respond on the first load, and then with the contents of | 847 // Makes |url| never respond on the first load, and then with the contents of |
835 // |file| afterwards. When the first load has been scheduled, runs |callback| on | 848 // |file| afterwards. When the first load has been scheduled, runs |callback| on |
836 // the UI thread. | 849 // the UI thread. |
837 void CreateHangingFirstRequestInterceptorOnIO( | 850 void CreateHangingFirstRequestInterceptorOnIO( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 | 929 |
917 net::URLRequestJob* MaybeInterceptRequest( | 930 net::URLRequestJob* MaybeInterceptRequest( |
918 net::URLRequest* request, | 931 net::URLRequest* request, |
919 net::NetworkDelegate* network_delegate) const override { | 932 net::NetworkDelegate* network_delegate) const override { |
920 MockHTTPJob* job = new MockHTTPJob(request, network_delegate, file_); | 933 MockHTTPJob* job = new MockHTTPJob(request, network_delegate, file_); |
921 job->set_start_callback(base::Bind(&CountingInterceptor::RequestStarted, | 934 job->set_start_callback(base::Bind(&CountingInterceptor::RequestStarted, |
922 weak_factory_.GetWeakPtr())); | 935 weak_factory_.GetWeakPtr())); |
923 return job; | 936 return job; |
924 } | 937 } |
925 | 938 |
| 939 net::URLRequestJob* MaybeInterceptResponse( |
| 940 net::URLRequest* request, |
| 941 net::NetworkDelegate* network_delegate) const override { |
| 942 return NULL; |
| 943 } |
| 944 |
| 945 net::URLRequestJob* MaybeInterceptRedirect( |
| 946 net::URLRequest* request, |
| 947 net::NetworkDelegate* network_delegate, |
| 948 const GURL& location) const override { |
| 949 return NULL; |
| 950 } |
| 951 |
926 void RequestStarted() { | 952 void RequestStarted() { |
927 BrowserThread::PostTask( | 953 BrowserThread::PostTask( |
928 BrowserThread::UI, FROM_HERE, | 954 BrowserThread::UI, FROM_HERE, |
929 base::Bind(&RequestCounter::RequestStarted, counter_)); | 955 base::Bind(&RequestCounter::RequestStarted, counter_)); |
930 } | 956 } |
931 | 957 |
932 private: | 958 private: |
933 base::FilePath file_; | 959 base::FilePath file_; |
934 base::WeakPtr<RequestCounter> counter_; | 960 base::WeakPtr<RequestCounter> counter_; |
935 mutable base::WeakPtrFactory<CountingInterceptor> weak_factory_; | 961 mutable base::WeakPtrFactory<CountingInterceptor> weak_factory_; |
(...skipping 3662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4598 TestShouldDisableLocalPredictorPreferenceNetworkMatrix( | 4624 TestShouldDisableLocalPredictorPreferenceNetworkMatrix( |
4599 true /*preference_wifi_network_wifi*/, | 4625 true /*preference_wifi_network_wifi*/, |
4600 true /*preference_wifi_network_4g*/, | 4626 true /*preference_wifi_network_4g*/, |
4601 true /*preference_always_network_wifi*/, | 4627 true /*preference_always_network_wifi*/, |
4602 false /*preference_always_network_4g*/, | 4628 false /*preference_always_network_4g*/, |
4603 true /*preference_never_network_wifi*/, | 4629 true /*preference_never_network_wifi*/, |
4604 true /*preference_never_network_4g*/); | 4630 true /*preference_never_network_4g*/); |
4605 } | 4631 } |
4606 | 4632 |
4607 } // namespace prerender | 4633 } // namespace prerender |
OLD | NEW |