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

Unified Diff: ios/web/navigation/window_location_inttest.mm

Issue 2600693002: Created test for window.location.assign() with unresolvable URLs. (Closed)
Patch Set: rebase Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/navigation/window_location_inttest.mm
diff --git a/ios/web/navigation/window_location_inttest.mm b/ios/web/navigation/window_location_inttest.mm
index 4e91f776861af486943e0b7012180303fd2da6e2..e5a16fba5ce8822ab9b2e9f6bed3340cc6dca4e4 100644
--- a/ios/web/navigation/window_location_inttest.mm
+++ b/ios/web/navigation/window_location_inttest.mm
@@ -121,6 +121,23 @@ bool IsOnLoadTextVisible() {
EXPECT_EQ(NSNotFound, GetIndexOfNavigationItem(about_blank_item));
}
+// Tests that calling window.location.assign() with an unresolvable URL loads
+// about:blank.
+TEST_F(WindowLocationTest, WindowLocationAssignUnresolvable) {
+ // Attempt to call window.location.assign() using an unresolvable URL.
+ GURL about_blank("about:blank");
+ GURL unresolvable_url("http:https:not a url");
+ SetWindowLocationUrl(unresolvable_url);
+ ExecuteBlockAndWaitForLoad(about_blank, ^{
+ ASSERT_TRUE(web::test::TapWebViewElementWithId(web_state(),
+ kWindowLocationAssignID));
+ });
+
+ // Verify that about:blank was actually loaded.
+ EXPECT_EQ(about_blank,
+ navigation_manager()->GetLastCommittedItem()->GetURL());
+}
+
// Tests that calling window.location.replace() doesn't create a new
// NavigationItem.
// TODO(crbug.com/307072): Enable test when location.replace is fixed.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698