| 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 #import "ios/chrome/browser/ui/history/history_entry_inserter.h" | 5 #import "ios/chrome/browser/ui/history/history_entry_inserter.h" |
| 6 | 6 |
| 7 #import "base/mac/foundation_util.h" | 7 #import "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 base::mac::ObjCCastStrict<NSArray<HistoryEntryItem*>>( | 87 base::mac::ObjCCastStrict<NSArray<HistoryEntryItem*>>( |
| 88 [model_ itemsInSectionWithIdentifier:kSectionIdentifierEnumZero + 1]); | 88 [model_ itemsInSectionWithIdentifier:kSectionIdentifierEnumZero + 1]); |
| 89 EXPECT_NSEQ(@"entry1", section_1[0].text); | 89 EXPECT_NSEQ(@"entry1", section_1[0].text); |
| 90 EXPECT_NSEQ(@"entry2", section_1[1].text); | 90 EXPECT_NSEQ(@"entry2", section_1[1].text); |
| 91 EXPECT_NSEQ(@"entry3", section_1[2].text); | 91 EXPECT_NSEQ(@"entry3", section_1[2].text); |
| 92 EXPECT_OCMOCK_VERIFY(mock_delegate); | 92 EXPECT_OCMOCK_VERIFY(mock_delegate); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Tests that items from different dates are added in correctly ordered | 95 // Tests that items from different dates are added in correctly ordered |
| 96 // sections. | 96 // sections. |
| 97 // TODO(crbug.com/700814): Reneable it. | 97 TEST_F(HistoryEntryInserterTest, AddSections) { |
| 98 TEST_F(HistoryEntryInserterTest, DISABLED_AddSections) { | |
| 99 base::Time today = | 98 base::Time today = |
| 100 base::Time::Now().LocalMidnight() + base::TimeDelta::FromHours(1); | 99 base::Time::Now().LocalMidnight() + base::TimeDelta::FromHours(12); |
| 101 base::TimeDelta day = base::TimeDelta::FromDays(1); | 100 base::TimeDelta day = base::TimeDelta::FromDays(1); |
| 102 base::TimeDelta minute = base::TimeDelta::FromMinutes(1); | 101 base::TimeDelta minute = base::TimeDelta::FromMinutes(1); |
| 103 HistoryEntryItem* day1 = TestHistoryEntryItem(today, "day1"); | 102 HistoryEntryItem* day1 = TestHistoryEntryItem(today, "day1"); |
| 104 HistoryEntryItem* day2_entry1 = | 103 HistoryEntryItem* day2_entry1 = |
| 105 TestHistoryEntryItem(today - day, "day2_entry1"); | 104 TestHistoryEntryItem(today - day, "day2_entry1"); |
| 106 HistoryEntryItem* day2_entry2 = | 105 HistoryEntryItem* day2_entry2 = |
| 107 TestHistoryEntryItem(today - day - minute, "day2_entry2"); | 106 TestHistoryEntryItem(today - day - minute, "day2_entry2"); |
| 108 HistoryEntryItem* day3 = TestHistoryEntryItem(today - 2 * day, "day3"); | 107 HistoryEntryItem* day3 = TestHistoryEntryItem(today - 2 * day, "day3"); |
| 109 | 108 |
| 110 OCMockObject* mock_delegate = (OCMockObject*)mock_delegate_.get(); | 109 OCMockObject* mock_delegate = (OCMockObject*)mock_delegate_.get(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // Empty the section for day 1, and remove the section. | 247 // Empty the section for day 1, and remove the section. |
| 249 [model_ removeItemWithType:kItemTypeEnumZero | 248 [model_ removeItemWithType:kItemTypeEnumZero |
| 250 fromSectionWithIdentifier:day1_identifier]; | 249 fromSectionWithIdentifier:day1_identifier]; |
| 251 [[mock_delegate expect] historyEntryInserter:inserter_ | 250 [[mock_delegate expect] historyEntryInserter:inserter_ |
| 252 didRemoveSectionAtIndex:1]; | 251 didRemoveSectionAtIndex:1]; |
| 253 [inserter_ removeSection:1]; | 252 [inserter_ removeSection:1]; |
| 254 | 253 |
| 255 EXPECT_EQ(2, [model_ numberOfSections]); | 254 EXPECT_EQ(2, [model_ numberOfSections]); |
| 256 EXPECT_OCMOCK_VERIFY(mock_delegate); | 255 EXPECT_OCMOCK_VERIFY(mock_delegate); |
| 257 } | 256 } |
| OLD | NEW |