| 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 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #import "base/test/ios/wait_util.h" | 14 #import "base/test/ios/wait_util.h" |
| 15 #import "ios/testing/ocmock_complex_type_helper.h" | 15 #import "ios/testing/ocmock_complex_type_helper.h" |
| 16 #import "ios/web/navigation/crw_session_controller.h" | 16 #import "ios/web/navigation/crw_session_controller.h" |
| 17 #import "ios/web/navigation/crw_session_entry.h" | |
| 18 #import "ios/web/navigation/navigation_item_impl.h" | 17 #import "ios/web/navigation/navigation_item_impl.h" |
| 19 #import "ios/web/navigation/navigation_manager_impl.h" | 18 #import "ios/web/navigation/navigation_manager_impl.h" |
| 20 #include "ios/web/public/referrer.h" | 19 #include "ios/web/public/referrer.h" |
| 21 #import "ios/web/public/test/fakes/test_native_content.h" | 20 #import "ios/web/public/test/fakes/test_native_content.h" |
| 22 #import "ios/web/public/test/fakes/test_native_content_provider.h" | 21 #import "ios/web/public/test/fakes/test_native_content_provider.h" |
| 23 #import "ios/web/public/test/fakes/test_web_client.h" | 22 #import "ios/web/public/test/fakes/test_web_client.h" |
| 24 #import "ios/web/public/test/fakes/test_web_state_delegate.h" | 23 #import "ios/web/public/test/fakes/test_web_state_delegate.h" |
| 25 #import "ios/web/public/test/fakes/test_web_view_content_view.h" | 24 #import "ios/web/public/test/fakes/test_web_view_content_view.h" |
| 26 #import "ios/web/public/web_state/crw_web_controller_observer.h" | 25 #import "ios/web/public/web_state/crw_web_controller_observer.h" |
| 27 #import "ios/web/public/web_state/ui/crw_content_view.h" | 26 #import "ios/web/public/web_state/ui/crw_content_view.h" |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 // Real WKWebView is required for CRWWebControllerNavigationTest. | 648 // Real WKWebView is required for CRWWebControllerNavigationTest. |
| 650 typedef web::WebTestWithWebController CRWWebControllerNavigationTest; | 649 typedef web::WebTestWithWebController CRWWebControllerNavigationTest; |
| 651 | 650 |
| 652 // Tests navigation between 2 URLs which differ only by fragment. | 651 // Tests navigation between 2 URLs which differ only by fragment. |
| 653 TEST_F(CRWWebControllerNavigationTest, GoToEntryWithoutDocumentChange) { | 652 TEST_F(CRWWebControllerNavigationTest, GoToEntryWithoutDocumentChange) { |
| 654 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test")); | 653 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test")); |
| 655 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test#hash")); | 654 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test#hash")); |
| 656 NavigationManagerImpl& nav_manager = | 655 NavigationManagerImpl& nav_manager = |
| 657 web_controller().webStateImpl->GetNavigationManagerImpl(); | 656 web_controller().webStateImpl->GetNavigationManagerImpl(); |
| 658 CRWSessionController* session_controller = nav_manager.GetSessionController(); | 657 CRWSessionController* session_controller = nav_manager.GetSessionController(); |
| 659 EXPECT_EQ(2U, session_controller.entries.count); | 658 EXPECT_EQ(2U, session_controller.items.size()); |
| 660 EXPECT_NSEQ(session_controller.entries.lastObject, | 659 EXPECT_EQ(session_controller.items.back(), session_controller.currentItem); |
| 661 session_controller.currentEntry); | |
| 662 | 660 |
| 663 [web_controller() goToItemAtIndex:0]; | 661 [web_controller() goToItemAtIndex:0]; |
| 664 EXPECT_NSEQ(session_controller.entries.firstObject, | 662 EXPECT_EQ(session_controller.items.front(), session_controller.currentItem); |
| 665 session_controller.currentEntry); | |
| 666 } | 663 } |
| 667 | 664 |
| 668 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that | 665 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that |
| 669 // a password field has been displayed on an HTTP page. | 666 // a password field has been displayed on an HTTP page. |
| 670 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) { | 667 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) { |
| 671 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); | 668 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); |
| 672 NavigationManagerImpl& nav_manager = | 669 NavigationManagerImpl& nav_manager = |
| 673 web_controller().webStateImpl->GetNavigationManagerImpl(); | 670 web_controller().webStateImpl->GetNavigationManagerImpl(); |
| 674 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & | 671 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & |
| 675 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); | 672 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 }; | 1064 }; |
| 1068 | 1065 |
| 1069 RenderProcessGoneObserver observer(web_state()); | 1066 RenderProcessGoneObserver observer(web_state()); |
| 1070 web::SimulateWKWebViewCrash(webView_); | 1067 web::SimulateWKWebViewCrash(webView_); |
| 1071 observer.WaitForRenderProcessGone(); | 1068 observer.WaitForRenderProcessGone(); |
| 1072 | 1069 |
| 1073 EXPECT_FALSE([web_controller() isViewAlive]); | 1070 EXPECT_FALSE([web_controller() isViewAlive]); |
| 1074 }; | 1071 }; |
| 1075 | 1072 |
| 1076 } // namespace | 1073 } // namespace |
| OLD | NEW |