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

Side by Side Diff: ios/chrome/test/earl_grey/chrome_actions.mm

Issue 2580333003: Upstream Chrome on iOS source code [10/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 #import "ios/chrome/test/earl_grey/chrome_actions.h"
6
7 #import "base/mac/foundation_util.h"
8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item .h"
9 #import "ios/chrome/test/app/chrome_test_util.h"
10 #import "ios/web/public/test/earl_grey/web_view_actions.h"
11
12 namespace chrome_test_util {
13
14 id<GREYAction> longPressElementForContextMenu(const std::string& element_id,
15 bool triggers_context_menu) {
16 return webViewLongPressElementForContextMenu(
17 chrome_test_util::GetCurrentWebState(), element_id,
18 triggers_context_menu);
19 }
20
21 id<GREYAction> turnCollectionViewSwitchOn(BOOL on) {
22 id<GREYMatcher> constraints = grey_not(grey_systemAlertViewShown());
23 NSString* actionName =
24 [NSString stringWithFormat:@"Turn collection view switch to %@ state",
25 on ? @"ON" : @"OFF"];
26 return [GREYActionBlock
27 actionWithName:actionName
28 constraints:constraints
29 performBlock:^BOOL(id collectionViewCell,
30 __strong NSError** errorOrNil) {
31 CollectionViewSwitchCell* switchCell =
32 base::mac::ObjCCastStrict<CollectionViewSwitchCell>(
33 collectionViewCell);
34 UISwitch* switchView = switchCell.switchView;
35 if (switchView.on ^ on) {
36 id<GREYAction> longPressAction = [GREYActions
37 actionForLongPressWithDuration:kGREYLongPressDefaultDuration];
38 return [longPressAction perform:switchView error:errorOrNil];
39 }
40 return YES;
41 }];
42 }
43
44 } // namespace chrome_test_util
OLDNEW
« no previous file with comments | « ios/chrome/test/earl_grey/chrome_actions.h ('k') | ios/chrome/test/earl_grey/chrome_assertions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698