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

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

Issue 2669123003: iOS: Mark HTTP pages with credit card fields with an omnibox icon. (Closed)
Patch Set: Update comments. Created 3 years, 10 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
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.mm ('k') | ios/web/web_state/web_state_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); 700 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test"));
701 NavigationManagerImpl& nav_manager = 701 NavigationManagerImpl& nav_manager =
702 web_controller().webStateImpl->GetNavigationManagerImpl(); 702 web_controller().webStateImpl->GetNavigationManagerImpl();
703 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & 703 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
704 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); 704 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
705 [web_controller() didShowPasswordInputOnHTTP]; 705 [web_controller() didShowPasswordInputOnHTTP];
706 EXPECT_TRUE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & 706 EXPECT_TRUE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
707 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); 707 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
708 } 708 }
709 709
710 // Tests that didShowCreditCardInputOnHTTP updates the SSLStatus to indicate
711 // that a credit card field has been displayed on an HTTP page.
712 TEST_F(CRWWebControllerNavigationTest, HTTPCreditCard) {
713 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test"));
714 NavigationManagerImpl& nav_manager =
715 web_controller().webStateImpl->GetNavigationManagerImpl();
716 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
717 web::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP);
718 [web_controller() didShowCreditCardInputOnHTTP];
719 EXPECT_TRUE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
720 web::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP);
721 }
722
710 // Real WKWebView is required for CRWWebControllerFormActivityTest. 723 // Real WKWebView is required for CRWWebControllerFormActivityTest.
711 typedef web::WebTestWithWebController CRWWebControllerFormActivityTest; 724 typedef web::WebTestWithWebController CRWWebControllerFormActivityTest;
712 725
713 // Tests that keyup event correctly delivered to WebStateObserver. 726 // Tests that keyup event correctly delivered to WebStateObserver.
714 TEST_F(CRWWebControllerFormActivityTest, KeyUpEvent) { 727 TEST_F(CRWWebControllerFormActivityTest, KeyUpEvent) {
715 // Observes and verifies FormActivityRegistered call. 728 // Observes and verifies FormActivityRegistered call.
716 class FormActivityObserver : public web::WebStateObserver { 729 class FormActivityObserver : public web::WebStateObserver {
717 public: 730 public:
718 explicit FormActivityObserver(web::WebState* web_state) 731 explicit FormActivityObserver(web::WebState* web_state)
719 : web::WebStateObserver(web_state) {} 732 : web::WebStateObserver(web_state) {}
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 }; 1056 };
1044 1057
1045 RenderProcessGoneObserver observer(web_state()); 1058 RenderProcessGoneObserver observer(web_state());
1046 web::SimulateWKWebViewCrash(webView_); 1059 web::SimulateWKWebViewCrash(webView_);
1047 observer.WaitForRenderProcessGone(); 1060 observer.WaitForRenderProcessGone();
1048 1061
1049 EXPECT_FALSE([web_controller() isViewAlive]); 1062 EXPECT_FALSE([web_controller() isViewAlive]);
1050 }; 1063 };
1051 1064
1052 } // namespace 1065 } // namespace
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.mm ('k') | ios/web/web_state/web_state_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698