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

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

Issue 2597133003: Created a test for window.location.reload(). (Closed)
Patch Set: Created 4 years 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 3da12faab80a7ca48ea1ee9960e95c7c27417c40..0dee49093045da8bb83921ac4a28796d888a9023 100644
--- a/ios/web/navigation/window_location_inttest.mm
+++ b/ios/web/navigation/window_location_inttest.mm
@@ -41,6 +41,7 @@
// Button IDs used in the window.location test page.
const char kWindowLocationAssignID[] = "location-assign";
const char kWindowLocationReplaceID[] = "location-replace";
+const char kWindowLocationReloadID[] = "location-reload";
// JavaScript functions on the window.location test page.
const char kUpdateURLScriptFormat[] = "updateUrlToLoadText('%s')";
@@ -285,3 +286,17 @@ NSInteger GetIndexOfNavigationItem(const web::NavigationItem* item) {
EXPECT_EQ(about_blank,
navigation_manager()->GetLastCommittedItem()->GetURL());
}
+
+// Tests that calling window.location.reload() causes an onload event to occur.
+TEST_F(WindowLocationTest, WindowLocationReload) {
+ // Tap the window.location.reload() button.
+ ExpectPageLoad(window_location_url());
+ ASSERT_TRUE(
+ web::test::TapWebViewElementWithId(web_state(), kWindowLocationReloadID));
+ WaitForPageToLoad();
+
+ // Verify that |kOnLoadText| is displayed and that no additional
+ // NavigationItems are added.
+ EXPECT_TRUE(IsOnLoadTextVisible());
+ EXPECT_EQ(1, (NSInteger)navigation_manager()->GetItemCount());
Eugene But (OOO till 7-30) 2016/12/23 01:57:34 Please don't use C-style casting, also this would
kkhorimoto 2017/01/20 00:38:20 Done.
+}
« 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