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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 } | 108 } |
109 // Matcher for the cancel button. | 109 // Matcher for the cancel button. |
110 id<GREYMatcher> CancelButton() { | 110 id<GREYMatcher> CancelButton() { |
111 return ButtonWithAccessibilityLabelId(IDS_HISTORY_CANCEL_EDITING_BUTTON); | 111 return ButtonWithAccessibilityLabelId(IDS_HISTORY_CANCEL_EDITING_BUTTON); |
112 } | 112 } |
113 // Matcher for the button to open the clear browsing data panel. | 113 // Matcher for the button to open the clear browsing data panel. |
114 id<GREYMatcher> OpenClearBrowsingDataButton() { | 114 id<GREYMatcher> OpenClearBrowsingDataButton() { |
115 return ButtonWithAccessibilityLabelId( | 115 return ButtonWithAccessibilityLabelId( |
116 IDS_HISTORY_OPEN_CLEAR_BROWSING_DATA_DIALOG); | 116 IDS_HISTORY_OPEN_CLEAR_BROWSING_DATA_DIALOG); |
117 } | 117 } |
118 // Matcher for the Open in New Tab option in the context menu. | |
119 id<GREYMatcher> OpenInNewTabButton() { | |
120 return ButtonWithAccessibilityLabelId(IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB); | |
121 } | |
122 // Matcher for the Open in New Incognito Tab option in the context menu. | 118 // Matcher for the Open in New Incognito Tab option in the context menu. |
123 id<GREYMatcher> OpenInNewIncognitoTabButton() { | 119 id<GREYMatcher> OpenInNewIncognitoTabButton() { |
124 return ButtonWithAccessibilityLabelId( | 120 return ButtonWithAccessibilityLabelId( |
125 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWINCOGNITOTAB); | 121 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWINCOGNITOTAB); |
126 } | 122 } |
127 // Matcher for the Copy URL option in the context menu. | 123 // Matcher for the Copy URL option in the context menu. |
128 id<GREYMatcher> CopyUrlButton() { | 124 id<GREYMatcher> CopyUrlButton() { |
129 return ButtonWithAccessibilityLabelId(IDS_IOS_CONTENT_CONTEXT_COPY); | 125 return ButtonWithAccessibilityLabelId(IDS_IOS_CONTENT_CONTEXT_COPY); |
130 } | 126 } |
131 // Matcher for the clear cookies cell on the clear browsing data panel. | 127 // Matcher for the clear cookies cell on the clear browsing data panel. |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 - (void)testContextMenuOpenInNewTab { | 419 - (void)testContextMenuOpenInNewTab { |
424 [self loadTestURLs]; | 420 [self loadTestURLs]; |
425 [self openHistoryPanel]; | 421 [self openHistoryPanel]; |
426 | 422 |
427 // Long press on the history element. | 423 // Long press on the history element. |
428 [[EarlGrey selectElementWithMatcher:HistoryEntry(_URL1, kTitle1)] | 424 [[EarlGrey selectElementWithMatcher:HistoryEntry(_URL1, kTitle1)] |
429 performAction:grey_longPress()]; | 425 performAction:grey_longPress()]; |
430 | 426 |
431 // Select "Open in New Tab" and confirm that new tab is opened with selected | 427 // Select "Open in New Tab" and confirm that new tab is opened with selected |
432 // URL. | 428 // URL. |
433 [[EarlGrey selectElementWithMatcher:OpenInNewTabButton()] | 429 [[EarlGrey |
430 selectElementWithMatcher:chrome_test_util::OpenLinkInNewTabMenuItem()] | |
Eugene But (OOO till 7-30)
2017/03/06 20:10:04
ditto
baxley
2017/03/06 20:53:34
Done.
| |
434 performAction:grey_tap()]; | 431 performAction:grey_tap()]; |
435 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( | 432 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |
436 _URL1.GetContent())] | 433 _URL1.GetContent())] |
437 assertWithMatcher:grey_notNil()]; | 434 assertWithMatcher:grey_notNil()]; |
438 chrome_test_util::AssertMainTabCount(2); | 435 chrome_test_util::AssertMainTabCount(2); |
439 } | 436 } |
440 | 437 |
441 // Tests display and selection of 'Open in New Incognito Tab' in a context menu | 438 // Tests display and selection of 'Open in New Incognito Tab' in a context menu |
442 // on a history entry. | 439 // on a history entry. |
443 - (void)testContextMenuOpenInNewIncognitoTab { | 440 - (void)testContextMenuOpenInNewIncognitoTab { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 - (void)resetBrowsingDataPrefs { | 534 - (void)resetBrowsingDataPrefs { |
538 PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs(); | 535 PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs(); |
539 prefs->ClearPref(browsing_data::prefs::kDeleteBrowsingHistory); | 536 prefs->ClearPref(browsing_data::prefs::kDeleteBrowsingHistory); |
540 prefs->ClearPref(browsing_data::prefs::kDeleteCookies); | 537 prefs->ClearPref(browsing_data::prefs::kDeleteCookies); |
541 prefs->ClearPref(browsing_data::prefs::kDeleteCache); | 538 prefs->ClearPref(browsing_data::prefs::kDeleteCache); |
542 prefs->ClearPref(browsing_data::prefs::kDeletePasswords); | 539 prefs->ClearPref(browsing_data::prefs::kDeletePasswords); |
543 prefs->ClearPref(browsing_data::prefs::kDeleteFormData); | 540 prefs->ClearPref(browsing_data::prefs::kDeleteFormData); |
544 } | 541 } |
545 | 542 |
546 @end | 543 @end |
OLD | NEW |