| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/webui/browsing_history_handler.h" | 5 #include "chrome/browser/ui/webui/browsing_history_handler.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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 base::Time correct_time = | 45 base::Time correct_time = |
| 46 baseline_time + base::TimeDelta::FromHours(correct_result.hour_offset); | 46 baseline_time + base::TimeDelta::FromHours(correct_result.hour_offset); |
| 47 | 47 |
| 48 return result.time == correct_time && result.url == GURL(correct_result.url); | 48 return result.time == correct_time && result.url == GURL(correct_result.url); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 // Tests that the MergeDuplicateResults method correctly removes duplicate | 53 // Tests that the MergeDuplicateResults method correctly removes duplicate |
| 54 // visits to the same URL on the same day. | 54 // visits to the same URL on the same day. |
| 55 TEST(BrowsingHistoryHandlerTest, MergeDuplicateResults) { | 55 // Fails on Android. http://crbug.com/2345 |
| 56 #if defined(OS_ANDROID) |
| 57 #define MAYBE_MergeDuplicateResults DISABLED_MergeDuplicateResults |
| 58 #else |
| 59 #define MAYBE_MergeDuplicateResults MergeDuplicateResults |
| 60 #endif |
| 61 TEST(BrowsingHistoryHandlerTest, MAYBE_MergeDuplicateResults) { |
| 56 { | 62 { |
| 57 // Basic test that duplicates on the same day are removed. | 63 // Basic test that duplicates on the same day are removed. |
| 58 TestResult test_data[] = { | 64 TestResult test_data[] = { |
| 59 { "http://google.com", 0 }, | 65 { "http://google.com", 0 }, |
| 60 { "http://google.de", 1 }, | 66 { "http://google.de", 1 }, |
| 61 { "http://google.com", 2 }, | 67 { "http://google.com", 2 }, |
| 62 { "http://google.com", 3 } // Most recent. | 68 { "http://google.com", 3 } // Most recent. |
| 63 }; | 69 }; |
| 64 std::vector<BrowsingHistoryHandler::HistoryEntry> results; | 70 std::vector<BrowsingHistoryHandler::HistoryEntry> results; |
| 65 AddQueryResults(test_data, arraysize(test_data), &results); | 71 AddQueryResults(test_data, arraysize(test_data), &results); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 AddQueryResults(test_data, arraysize(test_data), &results); | 130 AddQueryResults(test_data, arraysize(test_data), &results); |
| 125 BrowsingHistoryHandler::MergeDuplicateResults(&results); | 131 BrowsingHistoryHandler::MergeDuplicateResults(&results); |
| 126 | 132 |
| 127 ASSERT_EQ(2U, results.size()); | 133 ASSERT_EQ(2U, results.size()); |
| 128 EXPECT_TRUE(ResultEquals(results[0], test_data[3])); | 134 EXPECT_TRUE(ResultEquals(results[0], test_data[3])); |
| 129 EXPECT_TRUE(ResultEquals(results[1], test_data[1])); | 135 EXPECT_TRUE(ResultEquals(results[1], test_data[1])); |
| 130 EXPECT_EQ(3u, results[0].all_timestamps.size()); | 136 EXPECT_EQ(3u, results[0].all_timestamps.size()); |
| 131 EXPECT_EQ(1u, results[1].all_timestamps.size()); | 137 EXPECT_EQ(1u, results[1].all_timestamps.size()); |
| 132 } | 138 } |
| 133 } | 139 } |
| OLD | NEW |