| 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 "ios/chrome/browser/ios_chrome_io_thread.h" | 5 #include "ios/chrome/browser/ios_chrome_io_thread.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "components/prefs/pref_registry_simple.h" | 9 #include "components/prefs/pref_registry_simple.h" |
| 10 #include "components/prefs/pref_service.h" | 10 #include "components/prefs/pref_service.h" |
| 11 #include "components/prefs/pref_service_factory.h" | 11 #include "components/prefs/pref_service_factory.h" |
| 12 #include "components/prefs/testing_pref_store.h" | 12 #include "components/prefs/testing_pref_store.h" |
| 13 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" | 13 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
| 14 #include "components/ssl_config/ssl_config_service_manager.h" | 14 #include "components/ssl_config/ssl_config_service_manager.h" |
| 15 #include "ios/web/public/test/test_web_thread.h" | 15 #include "ios/web/public/test/test_web_thread.h" |
| 16 #include "net/test/url_request/url_request_failed_job.h" | 16 #include "net/test/url_request/url_request_failed_job.h" |
| 17 #include "net/url_request/url_fetcher.h" | 17 #include "net/url_request/url_fetcher.h" |
| 18 #include "net/url_request/url_fetcher_delegate.h" | 18 #include "net/url_request/url_fetcher_delegate.h" |
| 19 #include "net/url_request/url_request_filter.h" | 19 #include "net/url_request/url_request_filter.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "testing/gtest_mac.h" | 21 #include "testing/gtest_mac.h" |
| 22 #include "testing/platform_test.h" | 22 #include "testing/platform_test.h" |
| 23 | 23 |
| 24 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 25 #error "This file requires ARC support." |
| 26 #endif |
| 27 |
| 24 namespace { | 28 namespace { |
| 25 | 29 |
| 26 // A delegate interface for users of URLFetcher. | 30 // A delegate interface for users of URLFetcher. |
| 27 class TestURLFetcherDelegate : public net::URLFetcherDelegate { | 31 class TestURLFetcherDelegate : public net::URLFetcherDelegate { |
| 28 public: | 32 public: |
| 29 TestURLFetcherDelegate() {} | 33 TestURLFetcherDelegate() {} |
| 30 ~TestURLFetcherDelegate() override {} | 34 ~TestURLFetcherDelegate() override {} |
| 31 | 35 |
| 32 // net::URLFetcherDelegate implementation. | 36 // net::URLFetcherDelegate implementation. |
| 33 void OnURLFetchComplete(const net::URLFetcher* source) override {} | 37 void OnURLFetchComplete(const net::URLFetcher* source) override {} |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create( | 82 std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create( |
| 79 net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_IO_PENDING), | 83 net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_IO_PENDING), |
| 80 net::URLFetcher::GET, &fetcher_delegate); | 84 net::URLFetcher::GET, &fetcher_delegate); |
| 81 fetcher->SetRequestContext( | 85 fetcher->SetRequestContext( |
| 82 ios_chrome_io_thread->system_url_request_context_getter()); | 86 ios_chrome_io_thread->system_url_request_context_getter()); |
| 83 fetcher->Start(); | 87 fetcher->Start(); |
| 84 base::RunLoop().RunUntilIdle(); | 88 base::RunLoop().RunUntilIdle(); |
| 85 // Verify that there is no AssertNoUrlRequests triggered during CleanUp. | 89 // Verify that there is no AssertNoUrlRequests triggered during CleanUp. |
| 86 web_thread_delegate->CleanUp(); | 90 web_thread_delegate->CleanUp(); |
| 87 } | 91 } |
| OLD | NEW |