| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 return web_controller().pageDisplayState.scroll_state().offset_y() == 30.0; | 643 return web_controller().pageDisplayState.scroll_state().offset_y() == 30.0; |
| 644 }); | 644 }); |
| 645 | 645 |
| 646 ASSERT_FALSE(web_controller().atTop); | 646 ASSERT_FALSE(web_controller().atTop); |
| 647 }; | 647 }; |
| 648 | 648 |
| 649 // Real WKWebView is required for CRWWebControllerNavigationTest. | 649 // Real WKWebView is required for CRWWebControllerNavigationTest. |
| 650 typedef web::WebTestWithWebController CRWWebControllerNavigationTest; | 650 typedef web::WebTestWithWebController CRWWebControllerNavigationTest; |
| 651 | 651 |
| 652 // Tests navigation between 2 URLs which differ only by fragment. | 652 // Tests navigation between 2 URLs which differ only by fragment. |
| 653 TEST_F(CRWWebControllerNavigationTest, GoToEntryWithoutDocumentChange) { | 653 TEST_F(CRWWebControllerNavigationTest, GoToItemWithoutDocumentChange) { |
| 654 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test")); | 654 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test")); |
| 655 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test#hash")); | 655 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test#hash")); |
| 656 NavigationManagerImpl& nav_manager = | 656 NavigationManagerImpl& nav_manager = |
| 657 web_controller().webStateImpl->GetNavigationManagerImpl(); | 657 web_controller().webStateImpl->GetNavigationManagerImpl(); |
| 658 CRWSessionController* session_controller = nav_manager.GetSessionController(); | 658 CRWSessionController* session_controller = nav_manager.GetSessionController(); |
| 659 EXPECT_EQ(2U, session_controller.items.size()); | 659 EXPECT_EQ(2U, session_controller.items.size()); |
| 660 EXPECT_EQ(session_controller.items.back(), session_controller.currentItem); | 660 EXPECT_EQ(session_controller.items.back().get(), |
| 661 session_controller.currentItem); |
| 661 | 662 |
| 662 [web_controller() goToItemAtIndex:0]; | 663 [web_controller() goToItemAtIndex:0]; |
| 663 EXPECT_EQ(session_controller.items.front(), session_controller.currentItem); | 664 EXPECT_EQ(session_controller.items.front().get(), |
| 665 session_controller.currentItem); |
| 664 } | 666 } |
| 665 | 667 |
| 666 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that | 668 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that |
| 667 // a password field has been displayed on an HTTP page. | 669 // a password field has been displayed on an HTTP page. |
| 668 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) { | 670 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) { |
| 669 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); | 671 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); |
| 670 NavigationManagerImpl& nav_manager = | 672 NavigationManagerImpl& nav_manager = |
| 671 web_controller().webStateImpl->GetNavigationManagerImpl(); | 673 web_controller().webStateImpl->GetNavigationManagerImpl(); |
| 672 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & | 674 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & |
| 673 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); | 675 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 web::TestWebStateObserver* observer_ptr = &observer; | 1033 web::TestWebStateObserver* observer_ptr = &observer; |
| 1032 web::SimulateWKWebViewCrash(webView_); | 1034 web::SimulateWKWebViewCrash(webView_); |
| 1033 base::test::ios::WaitUntilCondition(^bool() { | 1035 base::test::ios::WaitUntilCondition(^bool() { |
| 1034 return observer_ptr->render_process_gone_info(); | 1036 return observer_ptr->render_process_gone_info(); |
| 1035 }); | 1037 }); |
| 1036 EXPECT_EQ(web_state(), observer.render_process_gone_info()->web_state); | 1038 EXPECT_EQ(web_state(), observer.render_process_gone_info()->web_state); |
| 1037 EXPECT_FALSE([web_controller() isViewAlive]); | 1039 EXPECT_FALSE([web_controller() isViewAlive]); |
| 1038 }; | 1040 }; |
| 1039 | 1041 |
| 1040 } // namespace | 1042 } // namespace |
| OLD | NEW |