| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/android/offline_pages/offline_page_request_job.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_request_job.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 kTestUrl, kTestClientId2, 0, std::move(archiver2), | 393 kTestUrl, kTestClientId2, 0, std::move(archiver2), |
| 394 base::Bind(&OfflinePageRequestJobTest::OnSavePageDone, | 394 base::Bind(&OfflinePageRequestJobTest::OnSavePageDone, |
| 395 base::Unretained(this))); | 395 base::Unretained(this))); |
| 396 RunUntilIdle(); | 396 RunUntilIdle(); |
| 397 | 397 |
| 398 // Create a context with delayed initialization. | 398 // Create a context with delayed initialization. |
| 399 test_url_request_context_.reset(new net::TestURLRequestContext(true)); | 399 test_url_request_context_.reset(new net::TestURLRequestContext(true)); |
| 400 | 400 |
| 401 // Install the interceptor. | 401 // Install the interceptor. |
| 402 std::unique_ptr<net::URLRequestInterceptor> interceptor( | 402 std::unique_ptr<net::URLRequestInterceptor> interceptor( |
| 403 new OfflinePageRequestInterceptor()); | 403 new OfflinePageRequestInterceptor(nullptr)); |
| 404 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory_impl( | 404 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory_impl( |
| 405 new net::URLRequestJobFactoryImpl()); | 405 new net::URLRequestJobFactoryImpl()); |
| 406 intercepting_job_factory_.reset(new TestURLRequestInterceptingJobFactory( | 406 intercepting_job_factory_.reset(new TestURLRequestInterceptingJobFactory( |
| 407 std::move(job_factory_impl), | 407 std::move(job_factory_impl), |
| 408 std::move(interceptor), | 408 std::move(interceptor), |
| 409 web_contents_.get())); | 409 web_contents_.get())); |
| 410 | 410 |
| 411 test_url_request_context_->set_job_factory(intercepting_job_factory_.get()); | 411 test_url_request_context_->set_job_factory(intercepting_job_factory_.get()); |
| 412 test_url_request_context_->Init(); | 412 test_url_request_context_->Init(); |
| 413 } | 413 } |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 base::RunLoop().Run(); | 756 base::RunLoop().Run(); |
| 757 | 757 |
| 758 EXPECT_EQ(0, bytes_read()); | 758 EXPECT_EQ(0, bytes_read()); |
| 759 EXPECT_FALSE(offline_page_tab_helper()->GetOfflinePageForTest()); | 759 EXPECT_FALSE(offline_page_tab_helper()->GetOfflinePageForTest()); |
| 760 ExpectAggregatedRequestResultHistogram( | 760 ExpectAggregatedRequestResultHistogram( |
| 761 OfflinePageRequestJob::AggregatedRequestResult:: | 761 OfflinePageRequestJob::AggregatedRequestResult:: |
| 762 PAGE_NOT_FOUND_ON_CONNECTED_NETWORK); | 762 PAGE_NOT_FOUND_ON_CONNECTED_NETWORK); |
| 763 } | 763 } |
| 764 | 764 |
| 765 } // namespace offline_pages | 765 } // namespace offline_pages |
| OLD | NEW |