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

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

Issue 2601503003: Created test for window.location.replace() 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 e5a16fba5ce8822ab9b2e9f6bed3340cc6dca4e4..e6d7aee417a09ab9470346fe662b8792ae44b258 100644
--- a/ios/web/navigation/window_location_inttest.mm
+++ b/ios/web/navigation/window_location_inttest.mm
@@ -169,3 +169,20 @@ bool IsOnLoadTextVisible() {
EXPECT_EQ(GetIndexOfNavigationItem(current_item) + 1,
GetIndexOfNavigationItem(about_blank_item));
}
+
+// Tests that calling window.location.replace() with an unresolvable URL loads
+// about:blank.
+TEST_F(WindowLocationTest, WindowLocationReplaceUnresolvable) {
+ // 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(),
+ kWindowLocationReplaceID));
+ });
+
+ // Verify that about:blank was actually loaded.
+ EXPECT_EQ(about_blank,
+ navigation_manager()->GetLastCommittedItem()->GetURL());
+}
« 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