| 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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 CRWSessionController* session_controller = nav_manager.GetSessionController(); | 751 CRWSessionController* session_controller = nav_manager.GetSessionController(); |
| 752 EXPECT_EQ(2U, session_controller.entries.count); | 752 EXPECT_EQ(2U, session_controller.entries.count); |
| 753 EXPECT_NSEQ(session_controller.entries.lastObject, | 753 EXPECT_NSEQ(session_controller.entries.lastObject, |
| 754 session_controller.currentEntry); | 754 session_controller.currentEntry); |
| 755 | 755 |
| 756 [web_controller() goToItemAtIndex:0]; | 756 [web_controller() goToItemAtIndex:0]; |
| 757 EXPECT_NSEQ(session_controller.entries.firstObject, | 757 EXPECT_NSEQ(session_controller.entries.firstObject, |
| 758 session_controller.currentEntry); | 758 session_controller.currentEntry); |
| 759 } | 759 } |
| 760 | 760 |
| 761 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that |
| 762 // a password field has been displayed on an HTTP page. |
| 763 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) { |
| 764 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); |
| 765 NavigationManagerImpl& nav_manager = |
| 766 web_controller().webStateImpl->GetNavigationManagerImpl(); |
| 767 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & |
| 768 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
| 769 [web_controller() didShowPasswordInputOnHTTP]; |
| 770 EXPECT_TRUE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & |
| 771 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
| 772 } |
| 773 |
| 761 // Real WKWebView is required for CRWWebControllerJSExecutionTest. | 774 // Real WKWebView is required for CRWWebControllerJSExecutionTest. |
| 762 typedef web::WebTestWithWebController CRWWebControllerJSExecutionTest; | 775 typedef web::WebTestWithWebController CRWWebControllerJSExecutionTest; |
| 763 | 776 |
| 764 // Tests that a script correctly evaluates to boolean. | 777 // Tests that a script correctly evaluates to boolean. |
| 765 TEST_F(CRWWebControllerJSExecutionTest, Execution) { | 778 TEST_F(CRWWebControllerJSExecutionTest, Execution) { |
| 766 LoadHtml(@"<p></p>"); | 779 LoadHtml(@"<p></p>"); |
| 767 EXPECT_NSEQ(@YES, ExecuteJavaScript(@"true")); | 780 EXPECT_NSEQ(@YES, ExecuteJavaScript(@"true")); |
| 768 EXPECT_NSEQ(@NO, ExecuteJavaScript(@"false")); | 781 EXPECT_NSEQ(@NO, ExecuteJavaScript(@"false")); |
| 769 } | 782 } |
| 770 | 783 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 | 1059 |
| 1047 [web_controller() setDelegate:delegate]; | 1060 [web_controller() setDelegate:delegate]; |
| 1048 web::SimulateWKWebViewCrash(webView_); | 1061 web::SimulateWKWebViewCrash(webView_); |
| 1049 | 1062 |
| 1050 EXPECT_OCMOCK_VERIFY(delegate); | 1063 EXPECT_OCMOCK_VERIFY(delegate); |
| 1051 EXPECT_FALSE([web_controller() isViewAlive]); | 1064 EXPECT_FALSE([web_controller() isViewAlive]); |
| 1052 [web_controller() setDelegate:nil]; | 1065 [web_controller() setDelegate:nil]; |
| 1053 }; | 1066 }; |
| 1054 | 1067 |
| 1055 } // namespace | 1068 } // namespace |
| OLD | NEW |