Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: components/image_fetcher/core/request_metadata_unittest.cc

Issue 2807143002: [Image fetcher] Add Content-Location header to image_fetcher::RequestMetadata (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/image_fetcher/core/request_metadata.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 "components/image_fetcher/core/request_metadata.h" 5 #include "components/image_fetcher/core/request_metadata.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "net/http/http_response_headers.h" 8 #include "net/http/http_response_headers.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace image_fetcher { 11 namespace image_fetcher {
12 12
13 TEST(RequestMetadataTest, Equality) { 13 TEST(RequestMetadataTest, Equality) {
14 RequestMetadata rhs; 14 RequestMetadata rhs;
15 RequestMetadata lhs; 15 RequestMetadata lhs;
16 rhs.mime_type = "testMimeType"; 16 rhs.mime_type = "testMimeType";
17 lhs.mime_type = "testMimeType"; 17 lhs.mime_type = "testMimeType";
18 rhs.http_response_code = 1; 18 rhs.http_response_code = 1;
19 lhs.http_response_code = 1; 19 lhs.http_response_code = 1;
20 rhs.from_http_cache = true; 20 rhs.from_http_cache = true;
21 lhs.from_http_cache = true; 21 lhs.from_http_cache = true;
22 lhs.content_location_header = "http://test-location.com/image.png";
23 rhs.content_location_header = "http://test-location.com/image.png";
22 24
23 EXPECT_EQ(rhs, lhs); 25 EXPECT_EQ(rhs, lhs);
24 } 26 }
25 27
26 TEST(RequestMetadataTest, NoEquality) { 28 TEST(RequestMetadataTest, NoEquality) {
27 RequestMetadata rhs; 29 RequestMetadata rhs;
28 RequestMetadata lhs; 30 RequestMetadata lhs;
29 rhs.mime_type = "testMimeType"; 31 rhs.mime_type = "testMimeType";
30 lhs.mime_type = "testMimeType"; 32 lhs.mime_type = "testMimeType";
31 rhs.http_response_code = 1; 33 rhs.http_response_code = 1;
32 lhs.http_response_code = 1; 34 lhs.http_response_code = 1;
33 rhs.from_http_cache = true; 35 rhs.from_http_cache = true;
34 lhs.from_http_cache = true; 36 lhs.from_http_cache = true;
37 lhs.content_location_header = "http://test-location.com/image.png";
38 rhs.content_location_header = "http://test-location.com/image.png";
35 39
36 lhs.mime_type = "testOtherMimeType"; 40 lhs.mime_type = "testOtherMimeType";
37 EXPECT_NE(rhs, lhs); 41 EXPECT_NE(rhs, lhs);
38 lhs.mime_type = "testMimeType"; 42 lhs.mime_type = "testMimeType";
39 43
40 lhs.http_response_code = 2; 44 lhs.http_response_code = 2;
41 EXPECT_NE(rhs, lhs); 45 EXPECT_NE(rhs, lhs);
42 lhs.http_response_code = 1; 46 lhs.http_response_code = 1;
43 47
44 lhs.from_http_cache = false; 48 lhs.from_http_cache = false;
45 EXPECT_NE(rhs, lhs); 49 EXPECT_NE(rhs, lhs);
46 lhs.from_http_cache = true; 50 lhs.from_http_cache = true;
51
52 lhs.content_location_header = "http://other.test-location.com/image.png";
53 EXPECT_NE(rhs, lhs);
54 lhs.content_location_header = "http://test-location.com/image.png";
47 } 55 }
48 56
49 } // namespace image_fetcher 57 } // namespace image_fetcher
OLDNEW
« no previous file with comments | « components/image_fetcher/core/request_metadata.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698