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

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: Add CRWWebController test. 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
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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); 695 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test"));
696 NavigationManagerImpl& nav_manager = 696 NavigationManagerImpl& nav_manager =
697 web_controller().webStateImpl->GetNavigationManagerImpl(); 697 web_controller().webStateImpl->GetNavigationManagerImpl();
698 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & 698 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
699 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); 699 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
700 [web_controller() didShowPasswordInputOnHTTP]; 700 [web_controller() didShowPasswordInputOnHTTP];
701 EXPECT_TRUE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & 701 EXPECT_TRUE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
702 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); 702 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
703 } 703 }
704 704
705 // Tests that didShowCreditCardInputOnHTTP updates the SSLStatus to indicate
706 // that a credit card field has been displayed on an HTTP page.
707 TEST_F(CRWWebControllerNavigationTest, HTTPCreditCard) {
708 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test"));
709 NavigationManagerImpl& nav_manager =
710 web_controller().webStateImpl->GetNavigationManagerImpl();
711 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
712 web::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP);
713 [web_controller() didShowCreditCardInputOnHTTP];
714 EXPECT_TRUE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
715 web::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP);
716 }
717
705 // Real WKWebView is required for CRWWebControllerFormActivityTest. 718 // Real WKWebView is required for CRWWebControllerFormActivityTest.
706 typedef web::WebTestWithWebController CRWWebControllerFormActivityTest; 719 typedef web::WebTestWithWebController CRWWebControllerFormActivityTest;
707 720
708 // Tests that keyup event correctly delivered to WebStateObserver. 721 // Tests that keyup event correctly delivered to WebStateObserver.
709 TEST_F(CRWWebControllerFormActivityTest, KeyUpEvent) { 722 TEST_F(CRWWebControllerFormActivityTest, KeyUpEvent) {
710 // Observes and verifies FormActivityRegistered call. 723 // Observes and verifies FormActivityRegistered call.
711 class FormActivityObserver : public web::WebStateObserver { 724 class FormActivityObserver : public web::WebStateObserver {
712 public: 725 public:
713 explicit FormActivityObserver(web::WebState* web_state) 726 explicit FormActivityObserver(web::WebState* web_state)
714 : web::WebStateObserver(web_state) {} 727 : web::WebStateObserver(web_state) {}
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 }; 1054 };
1042 1055
1043 RenderProcessGoneObserver observer(web_state()); 1056 RenderProcessGoneObserver observer(web_state());
1044 web::SimulateWKWebViewCrash(webView_); 1057 web::SimulateWKWebViewCrash(webView_);
1045 observer.WaitForRenderProcessGone(); 1058 observer.WaitForRenderProcessGone();
1046 1059
1047 EXPECT_FALSE([web_controller() isViewAlive]); 1060 EXPECT_FALSE([web_controller() isViewAlive]);
1048 }; 1061 };
1049 1062
1050 } // namespace 1063 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698