Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm

Issue 2659593002: Can request CollectionViewModel itemAtIndexPath with nil (Closed)
Patch Set: Add test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ui/collection_view/collection_view_model.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/collection_view/collection_view_model.h" 5 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" 9 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 [model addSectionWithIdentifier:SectionIdentifierCheese]; 70 [model addSectionWithIdentifier:SectionIdentifierCheese];
71 [model addItemWithType:ItemTypeCheeseCheddar 71 [model addItemWithType:ItemTypeCheeseCheddar
72 toSectionWithIdentifier:SectionIdentifierCheese]; 72 toSectionWithIdentifier:SectionIdentifierCheese];
73 [model addItemWithType:ItemTypeCheeseGouda 73 [model addItemWithType:ItemTypeCheeseGouda
74 toSectionWithIdentifier:SectionIdentifierCheese]; 74 toSectionWithIdentifier:SectionIdentifierCheese];
75 [model addItemWithType:ItemTypeCheesePepperJack 75 [model addItemWithType:ItemTypeCheesePepperJack
76 toSectionWithIdentifier:SectionIdentifierCheese]; 76 toSectionWithIdentifier:SectionIdentifierCheese];
77 77
78 // Check there are some items but not more. 78 // Check there are some items but not more.
79 EXPECT_EQ(NO, [model hasItemAtIndexPath:nil]);
79 EXPECT_EQ(YES, [model hasItemAtIndexPath:[NSIndexPath indexPathForItem:0 80 EXPECT_EQ(YES, [model hasItemAtIndexPath:[NSIndexPath indexPathForItem:0
80 inSection:0]]); 81 inSection:0]]);
81 EXPECT_EQ(YES, [model hasItemAtIndexPath:[NSIndexPath indexPathForItem:2 82 EXPECT_EQ(YES, [model hasItemAtIndexPath:[NSIndexPath indexPathForItem:2
82 inSection:0]]); 83 inSection:0]]);
83 EXPECT_EQ(NO, [model hasItemAtIndexPath:[NSIndexPath indexPathForItem:3 84 EXPECT_EQ(NO, [model hasItemAtIndexPath:[NSIndexPath indexPathForItem:3
84 inSection:0]]); 85 inSection:0]]);
85 EXPECT_EQ(NO, [model hasItemAtIndexPath:[NSIndexPath indexPathForItem:0 86 EXPECT_EQ(NO, [model hasItemAtIndexPath:[NSIndexPath indexPathForItem:0
86 inSection:1]]); 87 inSection:1]]);
87 88
88 // Check the collection view data sourcing methods. 89 // Check the collection view data sourcing methods.
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 584
584 EXPECT_FALSE([model footerForSectionWithIdentifier:SectionIdentifierCheese]); 585 EXPECT_FALSE([model footerForSectionWithIdentifier:SectionIdentifierCheese]);
585 EXPECT_FALSE([model footerForSection:cheeseSection]); 586 EXPECT_FALSE([model footerForSection:cheeseSection]);
586 587
587 EXPECT_EQ(weasleyFooter.get(), 588 EXPECT_EQ(weasleyFooter.get(),
588 [model footerForSectionWithIdentifier:SectionIdentifierWeasley]); 589 [model footerForSectionWithIdentifier:SectionIdentifierWeasley]);
589 EXPECT_EQ(weasleyFooter.get(), [model footerForSection:weasleySection]); 590 EXPECT_EQ(weasleyFooter.get(), [model footerForSection:weasleySection]);
590 } 591 }
591 592
592 } // namespace 593 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/collection_view/collection_view_model.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698