| 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 #import "base/strings/sys_string_conversions.h" | 9 #import "base/strings/sys_string_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 548 |
| 549 // Tests that an alert is presented after a new tab animation is finished. | 549 // Tests that an alert is presented after a new tab animation is finished. |
| 550 - (void)testShowJavaScriptAfterNewTabAnimation { | 550 - (void)testShowJavaScriptAfterNewTabAnimation { |
| 551 // TODO(crbug.com/663026): Reenable the test for devices. | 551 // TODO(crbug.com/663026): Reenable the test for devices. |
| 552 #if !TARGET_IPHONE_SIMULATOR | 552 #if !TARGET_IPHONE_SIMULATOR |
| 553 EARL_GREY_TEST_DISABLED(@"Disabled for devices because existing system " | 553 EARL_GREY_TEST_DISABLED(@"Disabled for devices because existing system " |
| 554 @"alerts would prevent app alerts to present " | 554 @"alerts would prevent app alerts to present " |
| 555 @"correctly."); | 555 @"correctly."); |
| 556 #endif | 556 #endif |
| 557 | 557 |
| 558 // TODO(crbug.com/711291): reenable this on tablets. |
| 559 if (IsIPadIdiom()) { |
| 560 EARL_GREY_TEST_DISABLED(@"Disabled for iPad."); |
| 561 } |
| 562 |
| 558 // Load the test page with a link to kOnLoadAlertURL and long tap on the link. | 563 // Load the test page with a link to kOnLoadAlertURL and long tap on the link. |
| 559 [self loadPageWithLink]; | 564 [self loadPageWithLink]; |
| 560 id<GREYMatcher> webViewMatcher = | 565 id<GREYMatcher> webViewMatcher = |
| 561 chrome_test_util::WebViewContainingText(std::string(kPageWithLinkText)); | 566 chrome_test_util::WebViewContainingText(std::string(kPageWithLinkText)); |
| 562 [[EarlGrey selectElementWithMatcher:webViewMatcher] | 567 [[EarlGrey selectElementWithMatcher:webViewMatcher] |
| 563 performAction:chrome_test_util::LongPressElementForContextMenu( | 568 performAction:chrome_test_util::LongPressElementForContextMenu( |
| 564 kLinkID, true /* menu should appear */)]; | 569 kLinkID, true /* menu should appear */)]; |
| 565 | 570 |
| 566 // Tap on the "Open In New Tab" button. | 571 // Tap on the "Open In New Tab" button. |
| 567 id<GREYMatcher> newTabMatcher = testing::ContextMenuItemWithText( | 572 id<GREYMatcher> newTabMatcher = testing::ContextMenuItemWithText( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 578 GURL onloadURL = HttpServer::MakeUrl(kOnLoadAlertURL); | 583 GURL onloadURL = HttpServer::MakeUrl(kOnLoadAlertURL); |
| 579 std::string title = base::UTF16ToUTF8(web::GetDisplayTitleForUrl(onloadURL)); | 584 std::string title = base::UTF16ToUTF8(web::GetDisplayTitleForUrl(onloadURL)); |
| 580 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(title)] | 585 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(title)] |
| 581 assertWithMatcher:grey_notNil()]; | 586 assertWithMatcher:grey_notNil()]; |
| 582 | 587 |
| 583 // Close the alert. | 588 // Close the alert. |
| 584 TapOK(); | 589 TapOK(); |
| 585 } | 590 } |
| 586 | 591 |
| 587 @end | 592 @end |
| OLD | NEW |