OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_REQUEST_FETCHER_TEST_BAS
E_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_REQUEST_FETCHER_TEST_BAS
E_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/test/test_simple_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "net/url_request/test_url_fetcher_factory.h" |
| 12 #include "net/url_request/url_request_test_util.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 |
| 15 namespace offline_pages { |
| 16 |
| 17 // Base class for testing prefetch requests with simulated responses. |
| 18 class PrefetchRequestTestBase : public testing::Test { |
| 19 public: |
| 20 PrefetchRequestTestBase(); |
| 21 ~PrefetchRequestTestBase() override; |
| 22 |
| 23 void RespondWithNetError(int net_error); |
| 24 void RespondWithHttpError(int http_error); |
| 25 void RespondWithData(const std::string& data); |
| 26 |
| 27 net::URLRequestContextGetter* request_context() const { |
| 28 return request_context_.get(); |
| 29 } |
| 30 |
| 31 private: |
| 32 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
| 33 base::ThreadTaskRunnerHandle task_runner_handle_; |
| 34 net::TestURLFetcherFactory url_fetcher_factory_; |
| 35 scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
| 36 }; |
| 37 |
| 38 } // namespace offline_pages |
| 39 |
| 40 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_REQUEST_FETCHER_TEST_
BASE_H_ |
OLD | NEW |