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

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

Issue 2466143002: iOS: Mark HTTP pages with password fields with an omnibox icon. (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 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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 CRWSessionController* session_controller = nav_manager.GetSessionController(); 762 CRWSessionController* session_controller = nav_manager.GetSessionController();
763 EXPECT_EQ(2U, session_controller.entries.count); 763 EXPECT_EQ(2U, session_controller.entries.count);
764 EXPECT_NSEQ(session_controller.entries.lastObject, 764 EXPECT_NSEQ(session_controller.entries.lastObject,
765 session_controller.currentEntry); 765 session_controller.currentEntry);
766 766
767 [web_controller() goToItemAtIndex:0]; 767 [web_controller() goToItemAtIndex:0];
768 EXPECT_NSEQ(session_controller.entries.firstObject, 768 EXPECT_NSEQ(session_controller.entries.firstObject,
769 session_controller.currentEntry); 769 session_controller.currentEntry);
770 } 770 }
771 771
772 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that
773 // a password field has been displayed on an HTTP page.
774 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) {
775 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test"));
776 NavigationManagerImpl& nav_manager =
777 web_controller().webStateImpl->GetNavigationManagerImpl();
778 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
779 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
780 [web_controller() didShowPasswordInputOnHTTP];
781 EXPECT_TRUE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
782 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
783 }
784
772 // Real WKWebView is required for CRWWebControllerJSExecutionTest. 785 // Real WKWebView is required for CRWWebControllerJSExecutionTest.
773 typedef web::WebTestWithWebController CRWWebControllerJSExecutionTest; 786 typedef web::WebTestWithWebController CRWWebControllerJSExecutionTest;
774 787
775 // Tests that a script correctly evaluates to boolean. 788 // Tests that a script correctly evaluates to boolean.
776 TEST_F(CRWWebControllerJSExecutionTest, Execution) { 789 TEST_F(CRWWebControllerJSExecutionTest, Execution) {
777 LoadHtml(@"<p></p>"); 790 LoadHtml(@"<p></p>");
778 EXPECT_NSEQ(@YES, ExecuteJavaScript(@"true")); 791 EXPECT_NSEQ(@YES, ExecuteJavaScript(@"true"));
779 EXPECT_NSEQ(@NO, ExecuteJavaScript(@"false")); 792 EXPECT_NSEQ(@NO, ExecuteJavaScript(@"false"));
780 } 793 }
781 794
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 1013
1001 [web_controller() setDelegate:delegate]; 1014 [web_controller() setDelegate:delegate];
1002 web::SimulateWKWebViewCrash(webView_); 1015 web::SimulateWKWebViewCrash(webView_);
1003 1016
1004 EXPECT_OCMOCK_VERIFY(delegate); 1017 EXPECT_OCMOCK_VERIFY(delegate);
1005 EXPECT_FALSE([web_controller() isViewAlive]); 1018 EXPECT_FALSE([web_controller() isViewAlive]);
1006 [web_controller() setDelegate:nil]; 1019 [web_controller() setDelegate:nil];
1007 }; 1020 };
1008 1021
1009 } // namespace 1022 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698