OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 void (^callable_block)(NSString*) = completion_handler; | 681 void (^callable_block)(NSString*) = completion_handler; |
682 callable_block(@"Maybe"); | 682 callable_block(@"Maybe"); |
683 }]; | 683 }]; |
684 | 684 |
685 [web_controller() setShouldSuppressDialogs:NO]; | 685 [web_controller() setShouldSuppressDialogs:NO]; |
686 EXPECT_NSEQ(@"Maybe", EvaluateJavaScriptAsString(@"prompt('Yes?', 'No')")); | 686 EXPECT_NSEQ(@"Maybe", EvaluateJavaScriptAsString(@"prompt('Yes?', 'No')")); |
687 } | 687 } |
688 | 688 |
689 // Tests that geolocation dialog is suppressed for DIALOG_POLICY_SUPPRESS. | 689 // Tests that geolocation dialog is suppressed for DIALOG_POLICY_SUPPRESS. |
690 TEST_F(CRWWebControllerPageDialogOpenPolicyTest, SuppressGeolocation) { | 690 TEST_F(CRWWebControllerPageDialogOpenPolicyTest, SuppressGeolocation) { |
691 // TODO(crbug.com/626688): The geolocation APIs require HTTPS on iOS 10. Find | |
692 // a way to trigger a geolocation prompt from this test. | |
693 if (base::ios::IsRunningOnIOS10OrLater()) { | |
694 return; | |
695 } | |
696 | |
691 [[web_delegate_mock() expect] | 697 [[web_delegate_mock() expect] |
692 webControllerDidSuppressDialog:web_controller()]; | 698 webControllerDidSuppressDialog:web_controller()]; |
693 [web_controller() setShouldSuppressDialogs:YES]; | 699 [web_controller() setShouldSuppressDialogs:YES]; |
694 EvaluateJavaScriptAsString(@"navigator.geolocation.getCurrentPosition()"); | 700 EvaluateJavaScriptAsString(@"navigator.geolocation.getCurrentPosition()"); |
695 } | 701 } |
696 | 702 |
697 // Tests that window.open is suppressed for DIALOG_POLICY_SUPPRESS. | 703 // Tests that window.open is suppressed for DIALOG_POLICY_SUPPRESS. |
698 TEST_F(CRWWebControllerPageDialogOpenPolicyTest, SuppressWindowOpen) { | 704 TEST_F(CRWWebControllerPageDialogOpenPolicyTest, SuppressWindowOpen) { |
699 [[web_delegate_mock() expect] | 705 [[web_delegate_mock() expect] |
700 webControllerDidSuppressDialog:web_controller()]; | 706 webControllerDidSuppressDialog:web_controller()]; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
750 return web_controller().pageDisplayState.scroll_state().offset_x() == 1.0; | 756 return web_controller().pageDisplayState.scroll_state().offset_x() == 1.0; |
751 }); | 757 }); |
752 | 758 |
753 ASSERT_EQ(original_zoom_state, | 759 ASSERT_EQ(original_zoom_state, |
754 web_controller().pageDisplayState.zoom_state()); | 760 web_controller().pageDisplayState.zoom_state()); |
755 }; | 761 }; |
756 | 762 |
757 // TODO(iOS): Flaky on the bots. crbug/493427 | 763 // TODO(iOS): Flaky on the bots. crbug/493427 |
758 TEST_F(CRWWebControllerPageScrollStateTest, | 764 TEST_F(CRWWebControllerPageScrollStateTest, |
759 FLAKY_SetPageDisplayStateWithUserScalableEnabled) { | 765 FLAKY_SetPageDisplayStateWithUserScalableEnabled) { |
766 // TODO(crbug.com/626688): Figure out why this test is hanging on iOS 10. | |
Eugene But (OOO till 7-30)
2016/07/08 21:14:35
This should not be necessary after this landed: ht
rohitrao (ping after 24h)
2016/07/08 22:53:31
Done.
| |
767 if (base::ios::IsRunningOnIOS10OrLater()) { | |
768 return; | |
769 } | |
770 | |
760 web::PageZoomState zoom_state(1.0, 10.0, 1.0); | 771 web::PageZoomState zoom_state(1.0, 10.0, 1.0); |
761 LoadHtml(GetHTMLForZoomState(zoom_state, PAGE_SCALABILITY_ENABLED)); | 772 LoadHtml(GetHTMLForZoomState(zoom_state, PAGE_SCALABILITY_ENABLED)); |
762 WaitForZoomRendering(web_controller(), zoom_state); | 773 WaitForZoomRendering(web_controller(), zoom_state); |
763 | 774 |
764 web::NavigationManager* nagivation_manager = | 775 web::NavigationManager* nagivation_manager = |
765 web_state()->GetNavigationManager(); | 776 web_state()->GetNavigationManager(); |
766 nagivation_manager->GetLastCommittedItem()->SetPageDisplayState( | 777 nagivation_manager->GetLastCommittedItem()->SetPageDisplayState( |
767 CreateTestPageDisplayState(CGPointMake(1.0, 1.0), // scroll offset | 778 CreateTestPageDisplayState(CGPointMake(1.0, 1.0), // scroll offset |
768 3.0, // relative zoom scale | 779 3.0, // relative zoom scale |
769 1.0, // original minimum zoom scale | 780 1.0, // original minimum zoom scale |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1064 | 1075 |
1065 [web_controller() setDelegate:delegate]; | 1076 [web_controller() setDelegate:delegate]; |
1066 web::SimulateWKWebViewCrash(webView_); | 1077 web::SimulateWKWebViewCrash(webView_); |
1067 | 1078 |
1068 EXPECT_OCMOCK_VERIFY(delegate); | 1079 EXPECT_OCMOCK_VERIFY(delegate); |
1069 EXPECT_FALSE([web_controller() isViewAlive]); | 1080 EXPECT_FALSE([web_controller() isViewAlive]); |
1070 [web_controller() setDelegate:nil]; | 1081 [web_controller() setDelegate:nil]; |
1071 }; | 1082 }; |
1072 | 1083 |
1073 } // namespace | 1084 } // namespace |
OLD | NEW |