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

Unified Diff: ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm

Issue 2957423002: Check page URL origin to determine JavaScript alert titles. (Closed)
Patch Set: Add string comparison unit test Created 3 years, 6 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
Index: ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm
diff --git a/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm b/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm
index 9d4f449c8b122d9b98ba99b3ad43a94b136333ef..a57d2427c0521678fa5e08eb4426f0a9c3caa2b0 100644
--- a/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm
+++ b/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm
@@ -201,10 +201,11 @@ void WaitForAlertToBeShown(NSString* alert_label) {
}
void WaitForJavaScripDialogToBeShown() {
- NSString* alert_label = [DialogPresenter
- localizedTitleForJavaScriptAlertFromPage:HttpServer::MakeUrl(
- kJavaScriptTestURL)];
- WaitForAlertToBeShown(alert_label);
+ GURL javaScriptURL = HttpServer::MakeUrl(kJavaScriptTestURL);
+ NSString* alertLabel =
+ [DialogPresenter localizedTitleForJavaScriptAlertFromPage:javaScriptURL
+ mainFrameURL:javaScriptURL];
+ WaitForAlertToBeShown(alertLabel);
}
// Injects JavaScript to show a dialog with |type|, verifying that it was
@@ -226,9 +227,10 @@ void ShowJavaScriptDialog(JavaScriptAlertType type) {
void AssertJavaScriptAlertNotPresent() {
ConditionBlock condition = ^{
NSError* error = nil;
+ GURL javaScriptURL = HttpServer::MakeUrl(kJavaScriptTestURL);
NSString* alertLabel = [DialogPresenter
- localizedTitleForJavaScriptAlertFromPage:HttpServer::MakeUrl(
- kJavaScriptTestURL)];
+ localizedTitleForJavaScriptAlertFromPage:javaScriptURL
+ mainFrameURL:javaScriptURL];
id<GREYMatcher> titleLabel =
chrome_test_util::StaticTextWithAccessibilityLabel(alertLabel);
[[EarlGrey selectElementWithMatcher:titleLabel] assertWithMatcher:grey_nil()
@@ -574,9 +576,10 @@ void TapSuppressDialogsButton() {
}
// Wait for the alert to be shown.
- NSString* alertLabel = [DialogPresenter
- localizedTitleForJavaScriptAlertFromPage:HttpServer::MakeUrl(
- kJavaScriptTestURL)];
+ GURL javaScriptURL = HttpServer::MakeUrl(kJavaScriptTestURL);
+ NSString* alertLabel =
+ [DialogPresenter localizedTitleForJavaScriptAlertFromPage:javaScriptURL
+ mainFrameURL:javaScriptURL];
WaitForAlertToBeShown(alertLabel);
// Verify that the omnibox shows the correct URL when the dialog is visible.

Powered by Google App Engine
This is Rietveld 408576698