| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/web/webui/url_fetcher_block_adapter.h" | 5 #import "ios/web/webui/url_fetcher_block_adapter.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 13 #include "base/test/scoped_task_environment.h" | 13 #include "base/test/scoped_task_environment.h" |
| 14 #include "net/url_request/test_url_fetcher_factory.h" | 14 #include "net/url_request/test_url_fetcher_factory.h" |
| 15 #include "net/url_request/url_request_status.h" | 15 #include "net/url_request/url_request_status.h" |
| 16 #include "net/url_request/url_request_test_util.h" | 16 #include "net/url_request/url_request_test_util.h" |
| 17 #import "testing/gtest_mac.h" | 17 #import "testing/gtest_mac.h" |
| 18 #include "testing/platform_test.h" | 18 #include "testing/platform_test.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 22 #error "This file requires ARC support." |
| 23 #endif |
| 24 |
| 21 namespace web { | 25 namespace web { |
| 22 | 26 |
| 23 // Test fixture for URLFetcherBlockAdapter. | 27 // Test fixture for URLFetcherBlockAdapter. |
| 24 class URLFetcherBlockAdapterTest : public PlatformTest { | 28 class URLFetcherBlockAdapterTest : public PlatformTest { |
| 25 protected: | 29 protected: |
| 26 URLFetcherBlockAdapterTest() | 30 URLFetcherBlockAdapterTest() |
| 27 : scoped_task_environment_( | 31 : scoped_task_environment_( |
| 28 base::test::ScopedTaskEnvironment::MainThreadType::UI) {} | 32 base::test::ScopedTaskEnvironment::MainThreadType::UI) {} |
| 29 | 33 |
| 30 // Required for base::MessageLoop::current(). | 34 // Required for base::MessageLoop::current(). |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 std::string response; | 71 std::string response; |
| 68 EXPECT_TRUE(ReadFileToString(favicon_path, &response)); | 72 EXPECT_TRUE(ReadFileToString(favicon_path, &response)); |
| 69 net::FakeURLFetcher fake_fetcher(test_url, &web_ui_fetcher, response, | 73 net::FakeURLFetcher fake_fetcher(test_url, &web_ui_fetcher, response, |
| 70 net::HTTP_OK, | 74 net::HTTP_OK, |
| 71 net::URLRequestStatus::SUCCESS); | 75 net::URLRequestStatus::SUCCESS); |
| 72 fake_fetcher.Start(); | 76 fake_fetcher.Start(); |
| 73 base::RunLoop().RunUntilIdle(); | 77 base::RunLoop().RunUntilIdle(); |
| 74 } | 78 } |
| 75 | 79 |
| 76 } // namespace web | 80 } // namespace web |
| OLD | NEW |