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

Side by Side Diff: ios/web/web_state/ui/crw_web_controller_unittest.mm

Issue 1806043004: [ios] Refactored dialogs suppression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 4 years, 9 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 unified diff | Download patch
OLDNEW
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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 }]; 543 }];
544 544
545 [webController_ setPageDialogOpenPolicy:web::DIALOG_POLICY_ALLOW]; 545 [webController_ setPageDialogOpenPolicy:web::DIALOG_POLICY_ALLOW];
546 EvaluateJavaScriptAsString(@"alert('test')"); 546 EvaluateJavaScriptAsString(@"alert('test')");
547 }; 547 };
548 548
549 // Tests that window.confirm dialog is suppressed for DIALOG_POLICY_SUPPRESS. 549 // Tests that window.confirm dialog is suppressed for DIALOG_POLICY_SUPPRESS.
550 TEST_F(CRWWebControllerPageDialogOpenPolicyTest, SuppressConfirm) { 550 TEST_F(CRWWebControllerPageDialogOpenPolicyTest, SuppressConfirm) {
551 [[web_delegate_mock() expect] webControllerDidSuppressDialog:webController_]; 551 [[web_delegate_mock() expect] webControllerDidSuppressDialog:webController_];
552 [webController_ setPageDialogOpenPolicy:web::DIALOG_POLICY_SUPPRESS]; 552 [webController_ setPageDialogOpenPolicy:web::DIALOG_POLICY_SUPPRESS];
553 EXPECT_NSEQ(@"", EvaluateJavaScriptAsString(@"confirm('test')")); 553 EXPECT_NSEQ(@"false", EvaluateJavaScriptAsString(@"confirm('test')"));
554 }; 554 };
555 555
556 // Tests that window.confirm dialog is shown for DIALOG_POLICY_ALLOW and 556 // Tests that window.confirm dialog is shown for DIALOG_POLICY_ALLOW and
557 // it's result is true. 557 // it's result is true.
558 TEST_F(CRWWebControllerPageDialogOpenPolicyTest, AllowConfirmWithTrue) { 558 TEST_F(CRWWebControllerPageDialogOpenPolicyTest, AllowConfirmWithTrue) {
559 SEL selector = @selector(webController: 559 SEL selector = @selector(webController:
560 runJavaScriptConfirmPanelWithMessage: 560 runJavaScriptConfirmPanelWithMessage:
561 requestURL: 561 requestURL:
562 completionHandler:); 562 completionHandler:);
563 [ui_delegate_mock() onSelector:selector 563 [ui_delegate_mock() onSelector:selector
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 988
989 [webController_ setDelegate:delegate]; 989 [webController_ setDelegate:delegate];
990 web::SimulateWKWebViewCrash(webView_); 990 web::SimulateWKWebViewCrash(webView_);
991 991
992 EXPECT_OCMOCK_VERIFY(delegate); 992 EXPECT_OCMOCK_VERIFY(delegate);
993 EXPECT_FALSE([webController_ isViewAlive]); 993 EXPECT_FALSE([webController_ isViewAlive]);
994 [webController_ setDelegate:nil]; 994 [webController_ setDelegate:nil];
995 }; 995 };
996 996
997 } // namespace 997 } // namespace
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller+protected.h ('k') | ios/web/web_state/ui/crw_wk_web_view_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698