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/reading_list/reading_list_collection_view_control
ler.h" | 5 #import "ios/chrome/browser/ui/reading_list/reading_list_collection_view_control
ler.h" |
6 | 6 |
7 #include <unordered_set> | 7 #include <unordered_set> |
8 | 8 |
9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // items. | 203 // items. |
204 TEST_F(ReadingListCollectionViewControllerTest, | 204 TEST_F(ReadingListCollectionViewControllerTest, |
205 TestItemInitializationDistilled) { | 205 TestItemInitializationDistilled) { |
206 // Setup. | 206 // Setup. |
207 GURL url("https://chromium.org"); | 207 GURL url("https://chromium.org"); |
208 std::string title("Chromium"); | 208 std::string title("Chromium"); |
209 GURL distilled_url("https://chromium.org/distilled"); | 209 GURL distilled_url("https://chromium.org/distilled"); |
210 base::FilePath distilled_path("/distilled/path"); | 210 base::FilePath distilled_path("/distilled/path"); |
211 reading_list_model_->AddEntry(url, title, | 211 reading_list_model_->AddEntry(url, title, |
212 reading_list::ADDED_VIA_CURRENT_APP); | 212 reading_list::ADDED_VIA_CURRENT_APP); |
213 reading_list_model_->SetEntryDistilledInfo(url, distilled_path, | 213 int64_t size = 50; |
214 distilled_url); | 214 reading_list_model_->SetEntryDistilledInfo(url, distilled_path, distilled_url, |
| 215 size); |
215 // Load view. | 216 // Load view. |
216 [reading_list_view_controller_ view]; | 217 [reading_list_view_controller_ view]; |
217 DCHECK([reading_list_view_controller_.get().collectionView | 218 DCHECK([reading_list_view_controller_.get().collectionView |
218 numberOfItemsInSection:0] == 1); | 219 numberOfItemsInSection:0] == 1); |
219 NSIndexPath* indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; | 220 NSIndexPath* indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; |
220 ReadingListCollectionViewItem* readingListItem = | 221 ReadingListCollectionViewItem* readingListItem = |
221 base::mac::ObjCCastStrict<ReadingListCollectionViewItem>( | 222 base::mac::ObjCCastStrict<ReadingListCollectionViewItem>( |
222 [[reading_list_view_controller_ collectionViewModel] | 223 [[reading_list_view_controller_ collectionViewModel] |
223 itemAtIndexPath:indexPath]); | 224 itemAtIndexPath:indexPath]); |
224 EXPECT_EQ(base::SysNSStringToUTF8([readingListItem text]), title); | 225 EXPECT_EQ(base::SysNSStringToUTF8([readingListItem text]), title); |
225 EXPECT_EQ([readingListItem url], url); | 226 EXPECT_EQ([readingListItem url], url); |
226 EXPECT_EQ(base::SysNSStringToUTF16([readingListItem detailText]), | 227 EXPECT_EQ(base::SysNSStringToUTF16([readingListItem detailText]), |
227 url_formatter::FormatUrl(url)); | 228 url_formatter::FormatUrl(url)); |
228 EXPECT_EQ([readingListItem faviconPageURL], distilled_url); | 229 EXPECT_EQ([readingListItem faviconPageURL], distilled_url); |
229 EXPECT_EQ([readingListItem distillationState], ReadingListEntry::PROCESSED); | 230 EXPECT_EQ([readingListItem distillationState], ReadingListEntry::PROCESSED); |
230 } | 231 } |
OLD | NEW |