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

Side by Side Diff: ios/chrome/browser/ui/collection_view/collection_view_controller_test.h

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_COLLECTION_VIEW_CONTROLLER_TEST_H_
6 #define IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_COLLECTION_VIEW_CONTROLLER_TEST_H_
7
8 #import <Foundation/Foundation.h>
9
10 #include "base/compiler_specific.h"
11 #import "base/ios/block_types.h"
12 #import "base/mac/scoped_nsobject.h"
13 #import "ios/chrome/test/block_cleanup_test.h"
14 #import "ios/third_party/material_components_ios/src/components/CollectionCells/ src/MaterialCollectionCells.h"
15
16 @class CollectionViewController;
17
18 class CollectionViewControllerTest : public BlockCleanupTest {
19 public:
20 CollectionViewControllerTest();
21 ~CollectionViewControllerTest() override;
22
23 protected:
24 void TearDown() override;
25
26 // Derived classes allocate their controller here.
27 virtual CollectionViewController* NewController() NS_RETURNS_RETAINED = 0;
28
29 // Tests should call this function to create their controller for testing.
30 void CreateController();
31
32 // Will call CreateController() if |controller_| is nil.
33 CollectionViewController* controller();
34
35 // Deletes the controller.
36 void ResetController();
37
38 // Tests that the controller's view, model, collectionView, and delegate are
39 // valid. Also tests that the model is the collectionView's data source.
40 void CheckController();
41
42 // Returns the number of sections in the collectionView.
43 int NumberOfSections();
44
45 // Returns the number of items in |section|.
46 int NumberOfItemsInSection(int section);
47
48 // Returns the collection view item at |item| in |section|.
49 id GetCollectionViewItem(int section, int item);
50
51 // Verifies that the title matches |expected_title|.
52 void CheckTitle(NSString* expected_title);
53
54 // Verifies that the title matches the l10n string for |expected_title_id|.
55 void CheckTitleWithId(int expected_title_id);
56
57 // Verifies that the section title at |section| matches the |expected_title|.
58 void CheckSectionHeader(NSString* expected_title, int section);
59
60 // Verifies that the section title at |section| matches the l10n string for
61 // |expected_title_id|.
62 void CheckSectionHeaderWithId(int expected_title_id, int section);
63
64 // Verifies that the section footer at |section| matches the |expected_text|.
65 // TODO(crbug.com/650424): Until the bug in MDC is fixed, footers are simple
66 // items in a dedicated section.
67 void CheckSectionFooter(NSString* expected_text, int section);
68
69 // Verifies that the section footer at |section| matches the l10n string for
70 // |expected_text_id|.
71 // TODO(crbug.com/650424): Until the bug in MDC is fixed, footers are simple
72 // items in a dedicated section.
73 void CheckSectionFooterWithId(int expected_text_id, int section);
74
75 // Verifies that the text cell at |item| in |section| has a title which
76 // matches |expected_title|.
77 void CheckTextCellTitle(NSString* expected_title, int section, int item);
78
79 // Verifies that the text cell at |item| in |section| has a title which
80 // matches the l10n string for |expected_title_id|.
81 void CheckTextCellTitleWithId(int expected_title_id, int section, int item);
82
83 // Verifies that the text cell at |item| in |section| has a title and subtitle
84 // which match strings for |expected_title| and |expected_subtitle|,
85 // respectively.
86 void CheckTextCellTitleAndSubtitle(NSString* expected_title,
87 NSString* expected_subtitle,
88 int section,
89 int item);
90
91 // Verifies that the text cell at |item| in |section| has a title and subtitle
92 // which match strings for |expected_title| and |expected_subtitle|,
93 // respectively.
94 void CheckDetailItemTextWithIds(int expected_text_id,
95 int expected_detail_text_id,
96 int section_id,
97 int item_id);
98
99 // Verifies that the switch cell at |item| in |section| has a title which
100 // matches |expected_title| and is currently in |state|.
101 void CheckSwitchCellStateAndTitle(BOOL expected_state,
102 NSString* expected_title,
103 int section,
104 int item);
105
106 // Verifies that the switch cell at |item| in |section| has a title which
107 // matches the l10n string for |expected_title_id| and is currently in
108 // |state|.
109 void CheckSwitchCellStateAndTitleWithId(BOOL expected_state,
110 int expected_title_id,
111 int section,
112 int item);
113
114 // Verifies that the cell at |item| in |section| has the given
115 // |accessory_type|.
116 void CheckAccessoryType(MDCCollectionViewCellAccessoryType accessory_type,
117 int section,
118 int item);
119
120 // For |section|, deletes the item at |item|. |completion_block| is called at
121 // the end of the call to -performBatchUpdates:completion:.
122 void DeleteItem(int section, int item, ProceduralBlock completion_block);
123
124 private:
125 base::scoped_nsobject<CollectionViewController> controller_;
126 };
127
128 #endif // IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_COLLECTION_VIEW_CONTROLLER_TEST _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698