| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ui/history/history_util.h" | 5 #include "ios/chrome/browser/ui/history/history_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "ios/chrome/browser/ui/history/history_entry.h" | 12 #include "ios/chrome/browser/ui/history/history_entry.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 16 #error "This file requires ARC support." |
| 17 #endif |
| 18 |
| 15 namespace { | 19 namespace { |
| 16 | 20 |
| 17 struct TestResult { | 21 struct TestResult { |
| 18 std::string url; | 22 std::string url; |
| 19 int64_t hour_offset; // Visit time in hours past the baseline time. | 23 int64_t hour_offset; // Visit time in hours past the baseline time. |
| 20 }; | 24 }; |
| 21 | 25 |
| 22 // Duplicates on the same day in the local timezone are removed, so set a | 26 // Duplicates on the same day in the local timezone are removed, so set a |
| 23 // baseline time in local time. | 27 // baseline time in local time. |
| 24 const base::Time baseline_time = base::Time::UnixEpoch().LocalMidnight(); | 28 const base::Time baseline_time = base::Time::UnixEpoch().LocalMidnight(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 AddQueryResults(test_data, arraysize(test_data), &results); | 128 AddQueryResults(test_data, arraysize(test_data), &results); |
| 125 history::MergeDuplicateHistoryEntries(&results); | 129 history::MergeDuplicateHistoryEntries(&results); |
| 126 | 130 |
| 127 ASSERT_EQ(2U, results.size()); | 131 ASSERT_EQ(2U, results.size()); |
| 128 EXPECT_TRUE(ResultEquals(results[0], test_data[3])); | 132 EXPECT_TRUE(ResultEquals(results[0], test_data[3])); |
| 129 EXPECT_TRUE(ResultEquals(results[1], test_data[1])); | 133 EXPECT_TRUE(ResultEquals(results[1], test_data[1])); |
| 130 EXPECT_EQ(3u, results[0].all_timestamps.size()); | 134 EXPECT_EQ(3u, results[0].all_timestamps.size()); |
| 131 EXPECT_EQ(1u, results[1].all_timestamps.size()); | 135 EXPECT_EQ(1u, results[1].all_timestamps.size()); |
| 132 } | 136 } |
| 133 } | 137 } |
| OLD | NEW |