Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <UIKit/UIKit.h> | 6 #import <UIKit/UIKit.h> |
| 7 #import <XCTest/XCTest.h> | 7 #import <XCTest/XCTest.h> |
| 8 | 8 |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "ios/chrome/browser/ui/ui_util.h" | 10 #include "ios/chrome/browser/ui/ui_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 @"Waiting for matcher %@ failed.", contextMenuItemButton); | 72 @"Waiting for matcher %@ failed.", contextMenuItemButton); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Long press on |elementId| to trigger context menu and then tap on | 75 // Long press on |elementId| to trigger context menu and then tap on |
| 76 // |contextMenuItemButton| item. | 76 // |contextMenuItemButton| item. |
| 77 void LongPressElementAndTapOnButton(const char* elementId, | 77 void LongPressElementAndTapOnButton(const char* elementId, |
| 78 id<GREYMatcher> contextMenuItemButton) { | 78 id<GREYMatcher> contextMenuItemButton) { |
| 79 id<GREYMatcher> webViewMatcher = | 79 id<GREYMatcher> webViewMatcher = |
| 80 web::WebViewInWebState(chrome_test_util::GetCurrentWebState()); | 80 web::WebViewInWebState(chrome_test_util::GetCurrentWebState()); |
| 81 [[EarlGrey selectElementWithMatcher:webViewMatcher] | 81 [[EarlGrey selectElementWithMatcher:webViewMatcher] |
| 82 performAction:chrome_test_util::longPressElementForContextMenu(elementId, | 82 performAction:chrome_test_util::LongPressElementForContextMenu( |
| 83 true)]; | 83 elementId, true /* menu should appear */)]; |
|
Eugene But (OOO till 7-30)
2017/03/24 16:24:31
Do you want to fix valriable name? s/elementId/ele
baxley
2017/03/24 16:48:07
Done.
| |
| 84 | 84 |
| 85 [[EarlGrey selectElementWithMatcher:contextMenuItemButton] | 85 [[EarlGrey selectElementWithMatcher:contextMenuItemButton] |
| 86 assertWithMatcher:grey_notNil()]; | 86 assertWithMatcher:grey_notNil()]; |
| 87 [[EarlGrey selectElementWithMatcher:contextMenuItemButton] | 87 [[EarlGrey selectElementWithMatcher:contextMenuItemButton] |
| 88 performAction:grey_tap()]; | 88 performAction:grey_tap()]; |
| 89 WaitForContextMenuItemDisappeared(contextMenuItemButton); | 89 WaitForContextMenuItemDisappeared(contextMenuItemButton); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // A simple wrapper that sleeps for 1s to wait for the animation, triggered from | 92 // A simple wrapper that sleeps for 1s to wait for the animation, triggered from |
| 93 // opening a new tab through context menu, to finish before selecting tab. | 93 // opening a new tab through context menu, to finish before selecting tab. |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 SelectTabAtIndexInCurrentMode(1U); | 256 SelectTabAtIndexInCurrentMode(1U); |
| 257 | 257 |
| 258 // Verify url and tab count. | 258 // Verify url and tab count. |
| 259 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( | 259 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |
| 260 destinationURL.GetContent())] | 260 destinationURL.GetContent())] |
| 261 assertWithMatcher:grey_notNil()]; | 261 assertWithMatcher:grey_notNil()]; |
| 262 chrome_test_util::AssertMainTabCount(2U); | 262 chrome_test_util::AssertMainTabCount(2U); |
| 263 } | 263 } |
| 264 | 264 |
| 265 @end | 265 @end |
| OLD | NEW |