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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm b/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm
new file mode 100644
index 0000000000000000000000000000000000000000..4c8d16152634af9c3020c163d5edcbc3790d710c
--- /dev/null
+++ b/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm
@@ -0,0 +1,62 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
+
+#import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h"
+#include "ios/chrome/browser/ui/uikit_ui_util.h"
+#import "ios/chrome/test/app/chrome_test_util.h"
+#include "ios/chrome/test/app/navigation_test_util.h"
+#import "ios/chrome/test/earl_grey/chrome_matchers.h"
+#import "ios/testing/wait_util.h"
+#import "ios/web/public/test/earl_grey/js_test_util.h"
+#import "ios/web/public/test/earl_grey/web_view_matchers.h"
+
+using testing::WaitUntilConditionOrTimeout;
+using testing::kWaitForPageLoadTimeout;
+
+@implementation ChromeEarlGreyUI
+
++ (void)openToolsMenu {
+ // TODO(crbug.com/639524): Add logic to ensure the app is in the correct
+ // state, for example DCHECK if no tabs are displayed.
+ [[[EarlGrey
+ selectElementWithMatcher:grey_allOf(chrome_test_util::toolsMenuButton(),
+ grey_sufficientlyVisible(), nil)]
+ usingSearchAction:grey_swipeSlowInDirection(kGREYDirectionDown)
+ onElementWithMatcher:web::webViewScrollView(
+ chrome_test_util::GetCurrentWebState())]
+ performAction:grey_tap()];
+ // TODO(crbug.com/639517): Add webViewScrollView matcher so we don't have
+ // to always find it.
+}
+
++ (void)openNewTab {
+ [ChromeEarlGreyUI openToolsMenu];
+ id<GREYMatcher> newTabButtonMatcher =
+ grey_accessibilityID(kToolsMenuNewTabId);
+ [[EarlGrey selectElementWithMatcher:newTabButtonMatcher]
+ performAction:grey_tap()];
+ [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
+}
+
++ (void)openNewIncognitoTab {
+ [ChromeEarlGreyUI openToolsMenu];
+ id<GREYMatcher> newIncognitoTabMatcher =
+ grey_accessibilityID(kToolsMenuNewIncognitoTabId);
+ [[EarlGrey selectElementWithMatcher:newIncognitoTabMatcher]
+ performAction:grey_tap()];
+ [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
+}
+
++ (void)reload {
+ // On iPhone Reload button is a part of tools menu, so open it.
+ if (IsCompact()) {
+ [self openToolsMenu];
+ }
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::reloadButton()]
+ performAction:grey_tap()];
+}
+
+@end
« 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