Skip to content

Commit

Permalink
Remove use of URLFetcher::ResponseCode in components/image_fetcher.
Browse files Browse the repository at this point in the history
URLFetcher is no longer being used in Chrome (except in the cloud print
service), and we want to get rid of it.

Also, while I'm here, clean up some unused net/ includes left over from
before the network service shipped.

Bug: 1010491
Change-Id: Ib2e0935d77af7f52132845b0c71602e6199e9547
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2289998
Reviewed-by: Brandon Wylie <wylieb@chromium.org>
Reviewed-by: Xing Liu <xingliu@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786999}
  • Loading branch information
Matt Menke authored and Commit Bot committed Jul 9, 2020
1 parent f37531c commit 2bf0b61
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
1 change: 1 addition & 0 deletions components/image_fetcher/core/image_data_fetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "components/image_fetcher/core/image_fetcher_types.h"
#include "components/image_fetcher/core/request_metadata.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/url_request.h"
#include "url/gurl.h"

namespace network {
Expand Down
8 changes: 3 additions & 5 deletions components/image_fetcher/core/image_data_fetcher_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#include "base/test/bind_test_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "net/base/load_flags.h"
#include "components/image_fetcher/core/request_metadata.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_status.h"
#include "net/url_request/url_request_test_util.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
Expand Down Expand Up @@ -272,7 +270,7 @@ TEST_F(ImageDataFetcherTest, FetchImageData_FailedRequest) {
ImageFetcherParams(TRAFFIC_ANNOTATION_FOR_TESTS, kTestUmaClientName));

RequestMetadata expected_metadata;
expected_metadata.http_response_code = net::URLFetcher::RESPONSE_CODE_INVALID;
expected_metadata.http_response_code = RequestMetadata::RESPONSE_CODE_INVALID;
EXPECT_CALL(
*this, OnImageDataFetchedFailedRequest(std::string(), expected_metadata));

Expand Down Expand Up @@ -325,7 +323,7 @@ TEST_F(ImageDataFetcherTest, FetchImageData_CancelFetchIfImageExceedsMaxSize) {
// There will be exactly one call to OnImageDataFetched containing a response
// code that would be impossible for a completed fetch.
RequestMetadata expected_metadata;
expected_metadata.http_response_code = net::URLFetcher::RESPONSE_CODE_INVALID;
expected_metadata.http_response_code = RequestMetadata::RESPONSE_CODE_INVALID;
EXPECT_CALL(*this, OnImageDataFetched(std::string(), expected_metadata));

EXPECT_TRUE(test_url_loader_factory_.IsPending(kImageURL));
Expand Down
1 change: 1 addition & 0 deletions components/image_fetcher/core/image_fetcher_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "components/image_fetcher/core/image_data_fetcher.h"
#include "components/image_fetcher/core/image_decoder.h"
#include "components/image_fetcher/core/image_fetcher.h"
Expand Down
6 changes: 1 addition & 5 deletions components/image_fetcher/core/request_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@

#include <string>

#include "net/url_request/url_fetcher.h"

namespace image_fetcher {

// Metadata for a URL request.
struct RequestMetadata {
// Impossible http response code. Used to signal that no http response code
// was received.
enum ResponseCode {
RESPONSE_CODE_INVALID = net::URLFetcher::RESPONSE_CODE_INVALID
};
enum ResponseCode { RESPONSE_CODE_INVALID = -1 };

RequestMetadata();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class IOSImageDataFetcherWrapper {
// be called with the downloaded image, or nil if any error happened. If the
// image is WebP it will be decoded.
// The |referrer| and |referrer_policy| will be passed on to the underlying
// URLFetcher.
// URLLoader.
// |callback| cannot be nil.
void FetchImageDataWebpDecoded(
const GURL& image_url,
Expand Down
1 change: 1 addition & 0 deletions components/query_tiles/internal/cached_image_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "components/image_fetcher/core/image_fetcher_service.h"
#include "components/image_fetcher/core/request_metadata.h"
#include "components/query_tiles/internal/stats.h"
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "third_party/skia/include/core/SkBitmap.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "base/test/task_environment.h"
#include "components/image_fetcher/core/mock_image_fetcher.h"
#include "components/image_fetcher/core/request_metadata.h"
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
Expand Down

0 comments on commit 2bf0b61

Please sign in to comment.