| OLD | NEW |
| 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/request_metadata.h" | 5 #include "components/image_fetcher/request_metadata.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace image_fetcher { | 9 namespace image_fetcher { |
| 10 | 10 |
| 11 TEST(RequestMetadataTest, Equality) { | 11 TEST(RequestMetadataTest, Equality) { |
| 12 RequestMetadata rhs; | 12 RequestMetadata rhs; |
| 13 RequestMetadata lhs; | 13 RequestMetadata lhs; |
| 14 rhs.mime_type = "testMimeType"; | 14 rhs.mime_type = "testMimeType"; |
| 15 lhs.mime_type = "testMimeType"; | 15 lhs.mime_type = "testMimeType"; |
| 16 rhs.response_code = 1; | 16 rhs.http_response_code = 1; |
| 17 lhs.response_code = 1; | 17 lhs.http_response_code = 1; |
| 18 rhs.from_http_cache = true; |
| 19 lhs.from_http_cache = true; |
| 18 | 20 |
| 19 EXPECT_EQ(rhs, lhs); | 21 EXPECT_EQ(rhs, lhs); |
| 20 } | 22 } |
| 21 | 23 |
| 22 TEST(RequestMetadataTest, NoEquality) { | 24 TEST(RequestMetadataTest, NoEquality) { |
| 23 RequestMetadata rhs; | 25 RequestMetadata rhs; |
| 24 RequestMetadata lhs; | 26 RequestMetadata lhs; |
| 25 rhs.mime_type = "testMimeType"; | 27 rhs.mime_type = "testMimeType"; |
| 26 lhs.mime_type = "testMimeType"; | 28 lhs.mime_type = "testMimeType"; |
| 27 rhs.response_code = 1; | 29 rhs.http_response_code = 1; |
| 28 lhs.response_code = 1; | 30 lhs.http_response_code = 1; |
| 31 rhs.from_http_cache = true; |
| 32 lhs.from_http_cache = true; |
| 29 | 33 |
| 30 lhs.mime_type = "testOtherMimeType"; | 34 lhs.mime_type = "testOtherMimeType"; |
| 31 EXPECT_NE(rhs, lhs); | 35 EXPECT_NE(rhs, lhs); |
| 32 lhs.mime_type = "testMimeType"; | 36 lhs.mime_type = "testMimeType"; |
| 33 | 37 |
| 34 lhs.response_code = 2; | 38 lhs.http_response_code = 2; |
| 35 EXPECT_NE(rhs, lhs); | 39 EXPECT_NE(rhs, lhs); |
| 36 lhs.response_code = 1; | 40 lhs.http_response_code = 1; |
| 41 |
| 42 lhs.from_http_cache = false; |
| 43 EXPECT_NE(rhs, lhs); |
| 44 lhs.from_http_cache = true; |
| 37 } | 45 } |
| 38 | 46 |
| 39 } // namespace image_fetcher | 47 } // namespace image_fetcher |
| OLD | NEW |