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 "base/mac/bind_objc_block.h" | 5 #import "base/mac/bind_objc_block.h" |
6 #include "base/mac/foundation_util.h" | 6 #include "base/mac/foundation_util.h" |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #import "base/strings/sys_string_conversions.h" | 8 #import "base/strings/sys_string_conversions.h" |
9 #include "base/test/ios/wait_util.h" | 9 #include "base/test/ios/wait_util.h" |
10 #import "ios/web/public/navigation_item.h" | 10 #import "ios/web/public/navigation_item.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 ASSERT_TRUE(web::test::TapWebViewElementWithId(web_state(), | 195 ASSERT_TRUE(web::test::TapWebViewElementWithId(web_state(), |
196 kWindowLocationReplaceID)); | 196 kWindowLocationReplaceID)); |
197 | 197 |
198 // Wait for the no-op text to appear. | 198 // Wait for the no-op text to appear. |
199 base::test::ios::WaitUntilCondition(^bool { | 199 base::test::ios::WaitUntilCondition(^bool { |
200 return IsNoOpTextVisible(); | 200 return IsNoOpTextVisible(); |
201 }); | 201 }); |
202 } | 202 } |
203 | 203 |
204 // Tests that calling window.location.reload() causes an onload event to occur. | 204 // Tests that calling window.location.reload() causes an onload event to occur. |
205 TEST_F(WindowLocationTest, WindowLocationReload) { | 205 #if TARGET_IPHONE_SIMULATOR |
| 206 #define MAYBE_WindowLocationReload WindowLocationReload |
| 207 #else |
| 208 #define MAYBE_WindowLocationReload FLAKY_WindowLocationReload |
| 209 #endif |
| 210 // TODO(crbug.com/721465): Enable this test on device. |
| 211 TEST_F(WindowLocationTest, MAYBE_WindowLocationReload) { |
206 // Tap the window.location.reload() button. | 212 // Tap the window.location.reload() button. |
207 ExecuteBlockAndWaitForLoad(window_location_url(), ^{ | 213 ExecuteBlockAndWaitForLoad(window_location_url(), ^{ |
208 ASSERT_TRUE(web::test::TapWebViewElementWithId(web_state(), | 214 ASSERT_TRUE(web::test::TapWebViewElementWithId(web_state(), |
209 kWindowLocationReloadID)); | 215 kWindowLocationReloadID)); |
210 }); | 216 }); |
211 | 217 |
212 // Verify that |kOnLoadText| is displayed and that no additional | 218 // Verify that |kOnLoadText| is displayed and that no additional |
213 // NavigationItems are added. | 219 // NavigationItems are added. |
214 EXPECT_TRUE(IsOnLoadTextVisible()); | 220 EXPECT_TRUE(IsOnLoadTextVisible()); |
215 EXPECT_EQ(1, navigation_manager()->GetItemCount()); | 221 EXPECT_EQ(1, navigation_manager()->GetItemCount()); |
(...skipping 18 matching lines...) Expand all Loading... |
234 SetWindowLocationUrl(sample_url); | 240 SetWindowLocationUrl(sample_url); |
235 ExecuteBlockAndWaitForLoad(sample_url, ^{ | 241 ExecuteBlockAndWaitForLoad(sample_url, ^{ |
236 ASSERT_TRUE(web::test::TapWebViewElementWithId( | 242 ASSERT_TRUE(web::test::TapWebViewElementWithId( |
237 web_state(), kWindowLocationSetToDOMStringID)); | 243 web_state(), kWindowLocationSetToDOMStringID)); |
238 }); | 244 }); |
239 | 245 |
240 // Verify that |sample_url| was loaded and that |about_blank_item| was pruned. | 246 // Verify that |sample_url| was loaded and that |about_blank_item| was pruned. |
241 EXPECT_EQ(sample_url, navigation_manager()->GetLastCommittedItem()->GetURL()); | 247 EXPECT_EQ(sample_url, navigation_manager()->GetLastCommittedItem()->GetURL()); |
242 EXPECT_EQ(NSNotFound, GetIndexOfNavigationItem(about_blank_item)); | 248 EXPECT_EQ(NSNotFound, GetIndexOfNavigationItem(about_blank_item)); |
243 } | 249 } |
OLD | NEW |