| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 | 1070 |
| 1065 [web_controller() setDelegate:delegate]; | 1071 [web_controller() setDelegate:delegate]; |
| 1066 web::SimulateWKWebViewCrash(webView_); | 1072 web::SimulateWKWebViewCrash(webView_); |
| 1067 | 1073 |
| 1068 EXPECT_OCMOCK_VERIFY(delegate); | 1074 EXPECT_OCMOCK_VERIFY(delegate); |
| 1069 EXPECT_FALSE([web_controller() isViewAlive]); | 1075 EXPECT_FALSE([web_controller() isViewAlive]); |
| 1070 [web_controller() setDelegate:nil]; | 1076 [web_controller() setDelegate:nil]; |
| 1071 }; | 1077 }; |
| 1072 | 1078 |
| 1073 } // namespace | 1079 } // namespace |
| OLD | NEW |