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

Unified Diff: ios/chrome/browser/context_menu/context_menu_egtest.mm

Issue 2640783005: Re-enable testContextMenuOpenInNewTabFromTallPage on device. (Closed)
Patch Set: Addressed feedback 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/context_menu/context_menu_egtest.mm
diff --git a/ios/chrome/browser/context_menu/context_menu_egtest.mm b/ios/chrome/browser/context_menu/context_menu_egtest.mm
index 65c652fda9189b8c9126a576507ee7c42cd32bf0..8e74f696d0f5618a3af6da65c9782226422138b5 100644
--- a/ios/chrome/browser/context_menu/context_menu_egtest.mm
+++ b/ios/chrome/browser/context_menu/context_menu_egtest.mm
@@ -57,6 +57,21 @@
return buttonWithAccessibilityLabelId(IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB);
}
+// Waits for the context menu to disappear. TODO(crbug.com/682871): Remove this
+// once EarlGrey is synchronized with context menu.
Eugene But (OOO till 7-30) 2017/01/20 00:00:14 Could you please document |matcher| argument. Sorr
liaoyuke 2017/01/20 00:16:21 Done.
+void WaitForContextMenuDisappeared(id<GREYMatcher> matcher) {
+ ConditionBlock condition = ^{
+ NSError* error = nil;
+ [[EarlGrey selectElementWithMatcher:matcher] assertWithMatcher:grey_nil()
+ error:&error];
+ return error == nil;
+ };
+ GREYAssert(
+ testing::WaitUntilConditionOrTimeout(testing::kWaitForUIElementTimeout,
+ condition),
+ [NSString stringWithFormat:@"Waiting for matcher %@ failed.", matcher]);
+}
+
// Long press on |elementId| to trigger context menu and then tap on
// |contextMenuItemButton| item.
void LongPressElementAndTapOnButton(const char* elementId,
@@ -70,8 +85,7 @@ void LongPressElementAndTapOnButton(const char* elementId,
assertWithMatcher:grey_notNil()];
[[EarlGrey selectElementWithMatcher:contextMenuItemButton]
performAction:grey_tap()];
- [[EarlGrey selectElementWithMatcher:contextMenuItemButton]
- assertWithMatcher:grey_nil()];
+ WaitForContextMenuDisappeared(contextMenuItemButton);
}
// A simple wrapper that sleeps for 1s to wait for the animation, triggered from
@@ -174,15 +188,7 @@ - (void)testContextMenuOpenInNewTab {
// Tests "Open in New Tab" on context menu on a link that requires scrolling
// on the page to verify that context menu can be properly triggered in the
// current screen view.
-// TODO(crbug.com/681130): Re-enable this test on device.
-#if TARGET_IPHONE_SIMULATOR
-#define MAYBE_testContextMenuOpenInNewTabFromTallPage \
- testContextMenuOpenInNewTabFromTallPage
-#else
-#define MAYBE_testContextMenuOpenInNewTabFromTallPage \
- FLAKY_testContextMenuOpenInNewTabFromTallPage
-#endif
-- (void)MAYBE_testContextMenuOpenInNewTabFromTallPage {
+- (void)testContextMenuOpenInNewTabFromTallPage {
// Set up test simple http server.
std::map<GURL, std::string> responses;
GURL initialURL =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698