Chromium Code Reviews| Index: components/offline_pages/core/prefetch/prefetch_request_test_base.h |
| diff --git a/components/offline_pages/core/prefetch/prefetch_request_test_base.h b/components/offline_pages/core/prefetch/prefetch_request_test_base.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dbbd5c883606a8f8d887857dfdbfcd5ceab7e89c |
| --- /dev/null |
| +++ b/components/offline_pages/core/prefetch/prefetch_request_test_base.h |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_REQUEST_FETCHER_TEST_BASE_H_ |
| +#define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_REQUEST_FETCHER_TEST_BASE_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/message_loop/message_loop.h" |
| +#include "net/url_request/test_url_fetcher_factory.h" |
| +#include "net/url_request/url_request_test_util.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace offline_pages { |
| + |
| +class PrefetchRequestTestBase : public testing::Test { |
|
dewittj
2017/05/11 21:51:48
nit: Class comment please
jianli
2017/05/11 23:07:28
Done.
|
| + public: |
| + PrefetchRequestTestBase(); |
| + ~PrefetchRequestTestBase() override; |
| + |
| + void RespondWithNetError(int net_error); |
| + void RespondWithHttpError(int http_error); |
| + void RespondWithData(const std::string& data); |
| + |
| + net::URLRequestContextGetter* request_context() const { |
| + return request_context_.get(); |
| + } |
| + |
| + private: |
| + base::MessageLoop message_loop_; |
|
dewittj
2017/05/11 21:51:48
is this used?
jianli
2017/05/11 23:07:28
This is needed in order to create a TaskRunner. Sw
|
| + net::TestURLFetcherFactory url_fetcher_factory_; |
| + scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
| +}; |
| + |
| +} // namespace offline_pages |
| + |
| +#endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_REQUEST_FETCHER_TEST_BASE_H_ |