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

Side by Side Diff: ios/chrome/test/earl_grey/chrome_earl_grey_ui.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_earl_grey_ui.h"
6
7 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h"
8 #include "ios/chrome/browser/ui/uikit_ui_util.h"
9 #import "ios/chrome/test/app/chrome_test_util.h"
10 #include "ios/chrome/test/app/navigation_test_util.h"
11 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
12 #import "ios/testing/wait_util.h"
13 #import "ios/web/public/test/earl_grey/js_test_util.h"
14 #import "ios/web/public/test/earl_grey/web_view_matchers.h"
15
16 using testing::WaitUntilConditionOrTimeout;
17 using testing::kWaitForPageLoadTimeout;
18
19 @implementation ChromeEarlGreyUI
20
21 + (void)openToolsMenu {
22 // TODO(crbug.com/639524): Add logic to ensure the app is in the correct
23 // state, for example DCHECK if no tabs are displayed.
24 [[[EarlGrey
25 selectElementWithMatcher:grey_allOf(chrome_test_util::toolsMenuButton(),
26 grey_sufficientlyVisible(), nil)]
27 usingSearchAction:grey_swipeSlowInDirection(kGREYDirectionDown)
28 onElementWithMatcher:web::webViewScrollView(
29 chrome_test_util::GetCurrentWebState())]
30 performAction:grey_tap()];
31 // TODO(crbug.com/639517): Add webViewScrollView matcher so we don't have
32 // to always find it.
33 }
34
35 + (void)openNewTab {
36 [ChromeEarlGreyUI openToolsMenu];
37 id<GREYMatcher> newTabButtonMatcher =
38 grey_accessibilityID(kToolsMenuNewTabId);
39 [[EarlGrey selectElementWithMatcher:newTabButtonMatcher]
40 performAction:grey_tap()];
41 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
42 }
43
44 + (void)openNewIncognitoTab {
45 [ChromeEarlGreyUI openToolsMenu];
46 id<GREYMatcher> newIncognitoTabMatcher =
47 grey_accessibilityID(kToolsMenuNewIncognitoTabId);
48 [[EarlGrey selectElementWithMatcher:newIncognitoTabMatcher]
49 performAction:grey_tap()];
50 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
51 }
52
53 + (void)reload {
54 // On iPhone Reload button is a part of tools menu, so open it.
55 if (IsCompact()) {
56 [self openToolsMenu];
57 }
58 [[EarlGrey selectElementWithMatcher:chrome_test_util::reloadButton()]
59 performAction:grey_tap()];
60 }
61
62 @end
OLDNEW
« no previous file with comments | « ios/chrome/test/earl_grey/chrome_earl_grey_ui.h ('k') | ios/chrome/test/earl_grey/chrome_matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698