| 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 |
| 11 #include "base/ios/ios_util.h" | 11 #include "base/ios/ios_util.h" |
| 12 #import "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
| 13 #import "base/test/ios/wait_util.h" | 13 #import "base/test/ios/wait_util.h" |
| 14 #import "ios/testing/ocmock_complex_type_helper.h" | 14 #import "ios/testing/ocmock_complex_type_helper.h" |
| 15 #import "ios/web/navigation/crw_session_controller.h" | 15 #import "ios/web/navigation/crw_session_controller.h" |
| 16 #import "ios/web/navigation/crw_session_entry.h" | |
| 17 #import "ios/web/navigation/navigation_item_impl.h" | 16 #import "ios/web/navigation/navigation_item_impl.h" |
| 18 #import "ios/web/navigation/navigation_manager_impl.h" | 17 #import "ios/web/navigation/navigation_manager_impl.h" |
| 19 #include "ios/web/public/referrer.h" | 18 #include "ios/web/public/referrer.h" |
| 20 #import "ios/web/public/test/fakes/test_native_content.h" | 19 #import "ios/web/public/test/fakes/test_native_content.h" |
| 21 #import "ios/web/public/test/fakes/test_native_content_provider.h" | 20 #import "ios/web/public/test/fakes/test_native_content_provider.h" |
| 22 #import "ios/web/public/test/fakes/test_web_client.h" | 21 #import "ios/web/public/test/fakes/test_web_client.h" |
| 23 #import "ios/web/public/test/fakes/test_web_state_delegate.h" | 22 #import "ios/web/public/test/fakes/test_web_state_delegate.h" |
| 24 #import "ios/web/public/test/fakes/test_web_view_content_view.h" | 23 #import "ios/web/public/test/fakes/test_web_view_content_view.h" |
| 25 #import "ios/web/public/web_state/crw_web_controller_observer.h" | 24 #import "ios/web/public/web_state/crw_web_controller_observer.h" |
| 26 #import "ios/web/public/web_state/ui/crw_content_view.h" | 25 #import "ios/web/public/web_state/ui/crw_content_view.h" |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 // Real WKWebView is required for CRWWebControllerNavigationTest. | 672 // Real WKWebView is required for CRWWebControllerNavigationTest. |
| 674 typedef web::WebTestWithWebController CRWWebControllerNavigationTest; | 673 typedef web::WebTestWithWebController CRWWebControllerNavigationTest; |
| 675 | 674 |
| 676 // Tests navigation between 2 URLs which differ only by fragment. | 675 // Tests navigation between 2 URLs which differ only by fragment. |
| 677 TEST_F(CRWWebControllerNavigationTest, GoToEntryWithoutDocumentChange) { | 676 TEST_F(CRWWebControllerNavigationTest, GoToEntryWithoutDocumentChange) { |
| 678 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test")); | 677 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test")); |
| 679 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test#hash")); | 678 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test#hash")); |
| 680 NavigationManagerImpl& nav_manager = | 679 NavigationManagerImpl& nav_manager = |
| 681 web_controller().webStateImpl->GetNavigationManagerImpl(); | 680 web_controller().webStateImpl->GetNavigationManagerImpl(); |
| 682 CRWSessionController* session_controller = nav_manager.GetSessionController(); | 681 CRWSessionController* session_controller = nav_manager.GetSessionController(); |
| 683 EXPECT_EQ(2U, session_controller.entries.count); | 682 EXPECT_EQ(2U, session_controller.items.size()); |
| 684 EXPECT_NSEQ(session_controller.entries.lastObject, | 683 EXPECT_EQ(session_controller.items.back(), |
| 685 session_controller.currentEntry); | 684 session_controller.currentItem); |
| 686 | 685 |
| 687 [web_controller() goToItemAtIndex:0]; | 686 [web_controller() goToItemAtIndex:0]; |
| 688 EXPECT_NSEQ(session_controller.entries.firstObject, | 687 EXPECT_EQ(session_controller.items.front(), |
| 689 session_controller.currentEntry); | 688 session_controller.currentItem); |
| 690 } | 689 } |
| 691 | 690 |
| 692 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that | 691 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that |
| 693 // a password field has been displayed on an HTTP page. | 692 // a password field has been displayed on an HTTP page. |
| 694 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) { | 693 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) { |
| 695 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); | 694 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); |
| 696 NavigationManagerImpl& nav_manager = | 695 NavigationManagerImpl& nav_manager = |
| 697 web_controller().webStateImpl->GetNavigationManagerImpl(); | 696 web_controller().webStateImpl->GetNavigationManagerImpl(); |
| 698 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & | 697 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & |
| 699 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); | 698 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 }; | 1054 }; |
| 1056 | 1055 |
| 1057 RenderProcessGoneObserver observer(web_state()); | 1056 RenderProcessGoneObserver observer(web_state()); |
| 1058 web::SimulateWKWebViewCrash(webView_); | 1057 web::SimulateWKWebViewCrash(webView_); |
| 1059 observer.WaitForRenderProcessGone(); | 1058 observer.WaitForRenderProcessGone(); |
| 1060 | 1059 |
| 1061 EXPECT_FALSE([web_controller() isViewAlive]); | 1060 EXPECT_FALSE([web_controller() isViewAlive]); |
| 1062 }; | 1061 }; |
| 1063 | 1062 |
| 1064 } // namespace | 1063 } // namespace |
| OLD | NEW |