| 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/offline_pages/core/prefetch/prefetch_item.h" | 5 #include "components/offline_pages/core/prefetch/prefetch_item.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "components/offline_pages/core/prefetch/prefetch_types.h" | 8 #include "components/offline_pages/core/prefetch/prefetch_types.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| 11 | 11 |
| 12 namespace offline_pages { | 12 namespace offline_pages { |
| 13 | 13 |
| 14 TEST(PrefetchItemTest, OperatorEqualsAndCopyConstructor) { | 14 TEST(PrefetchItemTest, OperatorEqualsAndCopyConstructor) { |
| 15 PrefetchItem item1; | 15 PrefetchItem item1; |
| 16 EXPECT_EQ(item1, PrefetchItem()); | 16 EXPECT_EQ(item1, PrefetchItem()); |
| 17 EXPECT_EQ(item1, PrefetchItem(item1)); | 17 EXPECT_EQ(item1, PrefetchItem(item1)); |
| 18 | 18 |
| 19 item1.guid = "A"; | 19 item1.guid = "A"; |
| 20 EXPECT_NE(item1, PrefetchItem()); | 20 EXPECT_NE(item1, PrefetchItem()); |
| 21 EXPECT_EQ(item1, PrefetchItem(item1)); | 21 EXPECT_EQ(item1, PrefetchItem(item1)); |
| 22 item1 = PrefetchItem(); | 22 item1 = PrefetchItem(); |
| 23 | 23 |
| 24 item1.client_name_space = "B"; | 24 item1.client_id = ClientId("B", "C"); |
| 25 EXPECT_NE(item1, PrefetchItem()); | 25 EXPECT_NE(item1, PrefetchItem()); |
| 26 EXPECT_EQ(item1, PrefetchItem(item1)); | 26 EXPECT_EQ(item1, PrefetchItem(item1)); |
| 27 item1 = PrefetchItem(); | 27 item1 = PrefetchItem(); |
| 28 | |
| 29 item1.client_id = "C"; | |
| 30 EXPECT_NE(item1, PrefetchItem()); | |
| 31 EXPECT_EQ(item1, PrefetchItem(item1)); | |
| 32 item1 = PrefetchItem(); | |
| 33 | 28 |
| 34 item1.state = PrefetchItemState::AWAITING_GCM; | 29 item1.state = PrefetchItemState::AWAITING_GCM; |
| 35 EXPECT_NE(item1, PrefetchItem()); | 30 EXPECT_NE(item1, PrefetchItem()); |
| 36 EXPECT_EQ(item1, PrefetchItem(item1)); | 31 EXPECT_EQ(item1, PrefetchItem(item1)); |
| 37 item1 = PrefetchItem(); | 32 item1 = PrefetchItem(); |
| 38 | 33 |
| 39 item1.url = GURL("http://test.com"); | 34 item1.url = GURL("http://test.com"); |
| 40 EXPECT_NE(item1, PrefetchItem()); | 35 EXPECT_NE(item1, PrefetchItem()); |
| 41 EXPECT_EQ(item1, PrefetchItem(item1)); | 36 EXPECT_EQ(item1, PrefetchItem(item1)); |
| 42 item1 = PrefetchItem(); | 37 item1 = PrefetchItem(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 EXPECT_NE(item1, PrefetchItem()); | 70 EXPECT_NE(item1, PrefetchItem()); |
| 76 EXPECT_EQ(item1, PrefetchItem(item1)); | 71 EXPECT_EQ(item1, PrefetchItem(item1)); |
| 77 item1 = PrefetchItem(); | 72 item1 = PrefetchItem(); |
| 78 | 73 |
| 79 item1.error_code = PrefetchItemErrorCode::EXPIRED; | 74 item1.error_code = PrefetchItemErrorCode::EXPIRED; |
| 80 EXPECT_NE(item1, PrefetchItem()); | 75 EXPECT_NE(item1, PrefetchItem()); |
| 81 EXPECT_EQ(item1, PrefetchItem(item1)); | 76 EXPECT_EQ(item1, PrefetchItem(item1)); |
| 82 } | 77 } |
| 83 | 78 |
| 84 } // namespace offline_pages | 79 } // namespace offline_pages |
| OLD | NEW |