| 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/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #import "ios/web/public/test/http_server_util.h" | 36 #import "ios/web/public/test/http_server_util.h" |
| 37 #import "net/base/mac/url_conversions.h" | 37 #import "net/base/mac/url_conversions.h" |
| 38 #include "ui/base/l10n/l10n_util.h" | 38 #include "ui/base/l10n/l10n_util.h" |
| 39 | 39 |
| 40 #if !defined(__has_feature) || !__has_feature(objc_arc) | 40 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 41 #error "This file requires ARC support." | 41 #error "This file requires ARC support." |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 using chrome_test_util::ButtonWithAccessibilityLabelId; | 44 using chrome_test_util::ButtonWithAccessibilityLabelId; |
| 45 using chrome_test_util::NavigationBarDoneButton; | 45 using chrome_test_util::NavigationBarDoneButton; |
| 46 using chrome_test_util::OpenLinkInNewTabMenuItem; | 46 using chrome_test_util::OpenLinkInNewTabButton; |
| 47 using chrome_test_util::WebViewContainingText; | 47 using chrome_test_util::WebViewContainingText; |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| 50 char kURL1[] = "http://firstURL"; | 50 char kURL1[] = "http://firstURL"; |
| 51 char kURL2[] = "http://secondURL"; | 51 char kURL2[] = "http://secondURL"; |
| 52 char kURL3[] = "http://thirdURL"; | 52 char kURL3[] = "http://thirdURL"; |
| 53 char kTitle1[] = "Page 1"; | 53 char kTitle1[] = "Page 1"; |
| 54 char kTitle2[] = "Page 2"; | 54 char kTitle2[] = "Page 2"; |
| 55 char kResponse1[] = "Test Page 1 content"; | 55 char kResponse1[] = "Test Page 1 content"; |
| 56 char kResponse2[] = "Test Page 2 content"; | 56 char kResponse2[] = "Test Page 2 content"; |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 - (void)testContextMenuOpenInNewTab { | 417 - (void)testContextMenuOpenInNewTab { |
| 418 [self loadTestURLs]; | 418 [self loadTestURLs]; |
| 419 [self openHistoryPanel]; | 419 [self openHistoryPanel]; |
| 420 | 420 |
| 421 // Long press on the history element. | 421 // Long press on the history element. |
| 422 [[EarlGrey selectElementWithMatcher:HistoryEntry(_URL1, kTitle1)] | 422 [[EarlGrey selectElementWithMatcher:HistoryEntry(_URL1, kTitle1)] |
| 423 performAction:grey_longPress()]; | 423 performAction:grey_longPress()]; |
| 424 | 424 |
| 425 // Select "Open in New Tab" and confirm that new tab is opened with selected | 425 // Select "Open in New Tab" and confirm that new tab is opened with selected |
| 426 // URL. | 426 // URL. |
| 427 [[EarlGrey selectElementWithMatcher:OpenLinkInNewTabMenuItem()] | 427 [[EarlGrey selectElementWithMatcher:OpenLinkInNewTabButton()] |
| 428 performAction:grey_tap()]; | 428 performAction:grey_tap()]; |
| 429 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( | 429 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |
| 430 _URL1.GetContent())] | 430 _URL1.GetContent())] |
| 431 assertWithMatcher:grey_notNil()]; | 431 assertWithMatcher:grey_notNil()]; |
| 432 chrome_test_util::AssertMainTabCount(2); | 432 chrome_test_util::AssertMainTabCount(2); |
| 433 } | 433 } |
| 434 | 434 |
| 435 // Tests display and selection of 'Open in New Incognito Tab' in a context menu | 435 // Tests display and selection of 'Open in New Incognito Tab' in a context menu |
| 436 // on a history entry. | 436 // on a history entry. |
| 437 - (void)testContextMenuOpenInNewIncognitoTab { | 437 - (void)testContextMenuOpenInNewIncognitoTab { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 - (void)resetBrowsingDataPrefs { | 529 - (void)resetBrowsingDataPrefs { |
| 530 PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs(); | 530 PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs(); |
| 531 prefs->ClearPref(browsing_data::prefs::kDeleteBrowsingHistory); | 531 prefs->ClearPref(browsing_data::prefs::kDeleteBrowsingHistory); |
| 532 prefs->ClearPref(browsing_data::prefs::kDeleteCookies); | 532 prefs->ClearPref(browsing_data::prefs::kDeleteCookies); |
| 533 prefs->ClearPref(browsing_data::prefs::kDeleteCache); | 533 prefs->ClearPref(browsing_data::prefs::kDeleteCache); |
| 534 prefs->ClearPref(browsing_data::prefs::kDeletePasswords); | 534 prefs->ClearPref(browsing_data::prefs::kDeletePasswords); |
| 535 prefs->ClearPref(browsing_data::prefs::kDeleteFormData); | 535 prefs->ClearPref(browsing_data::prefs::kDeleteFormData); |
| 536 } | 536 } |
| 537 | 537 |
| 538 @end | 538 @end |
| OLD | NEW |