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

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

Issue 2705673003: Removed CRWSessionEntry from CRWWebController. (Closed)
Patch Set: reintroduced delegate callback Created 3 years, 9 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.mm » ('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
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 #include "ios/web/public/test/fakes/test_web_state_observer.h" 24 #include "ios/web/public/test/fakes/test_web_state_observer.h"
26 #import "ios/web/public/test/fakes/test_web_view_content_view.h" 25 #import "ios/web/public/test/fakes/test_web_view_content_view.h"
27 #import "ios/web/public/web_state/crw_web_controller_observer.h" 26 #import "ios/web/public/web_state/crw_web_controller_observer.h"
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 // Real WKWebView is required for CRWWebControllerNavigationTest. 649 // Real WKWebView is required for CRWWebControllerNavigationTest.
651 typedef web::WebTestWithWebController CRWWebControllerNavigationTest; 650 typedef web::WebTestWithWebController CRWWebControllerNavigationTest;
652 651
653 // Tests navigation between 2 URLs which differ only by fragment. 652 // Tests navigation between 2 URLs which differ only by fragment.
654 TEST_F(CRWWebControllerNavigationTest, GoToEntryWithoutDocumentChange) { 653 TEST_F(CRWWebControllerNavigationTest, GoToEntryWithoutDocumentChange) {
655 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test")); 654 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test"));
656 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test#hash")); 655 LoadHtml(@"<html><body></body></html>", GURL("https://chromium.test#hash"));
657 NavigationManagerImpl& nav_manager = 656 NavigationManagerImpl& nav_manager =
658 web_controller().webStateImpl->GetNavigationManagerImpl(); 657 web_controller().webStateImpl->GetNavigationManagerImpl();
659 CRWSessionController* session_controller = nav_manager.GetSessionController(); 658 CRWSessionController* session_controller = nav_manager.GetSessionController();
660 EXPECT_EQ(2U, session_controller.entries.count); 659 EXPECT_EQ(2U, session_controller.items.size());
661 EXPECT_NSEQ(session_controller.entries.lastObject, 660 EXPECT_EQ(session_controller.items.back(), session_controller.currentItem);
662 session_controller.currentEntry);
663 661
664 [web_controller() goToItemAtIndex:0]; 662 [web_controller() goToItemAtIndex:0];
665 EXPECT_NSEQ(session_controller.entries.firstObject, 663 EXPECT_EQ(session_controller.items.front(), session_controller.currentItem);
666 session_controller.currentEntry);
667 } 664 }
668 665
669 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that 666 // Tests that didShowPasswordInputOnHTTP updates the SSLStatus to indicate that
670 // a password field has been displayed on an HTTP page. 667 // a password field has been displayed on an HTTP page.
671 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) { 668 TEST_F(CRWWebControllerNavigationTest, HTTPPassword) {
672 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test")); 669 LoadHtml(@"<html><body></body></html>", GURL("http://chromium.test"));
673 NavigationManagerImpl& nav_manager = 670 NavigationManagerImpl& nav_manager =
674 web_controller().webStateImpl->GetNavigationManagerImpl(); 671 web_controller().webStateImpl->GetNavigationManagerImpl();
675 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status & 672 EXPECT_FALSE(nav_manager.GetLastCommittedItem()->GetSSL().content_status &
676 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); 673 web::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 web::TestWebStateObserver* observer_ptr = &observer; 1031 web::TestWebStateObserver* observer_ptr = &observer;
1035 web::SimulateWKWebViewCrash(webView_); 1032 web::SimulateWKWebViewCrash(webView_);
1036 base::test::ios::WaitUntilCondition(^bool() { 1033 base::test::ios::WaitUntilCondition(^bool() {
1037 return observer_ptr->render_process_gone_info(); 1034 return observer_ptr->render_process_gone_info();
1038 }); 1035 });
1039 EXPECT_EQ(web_state(), observer.render_process_gone_info()->web_state); 1036 EXPECT_EQ(web_state(), observer.render_process_gone_info()->web_state);
1040 EXPECT_FALSE([web_controller() isViewAlive]); 1037 EXPECT_FALSE([web_controller() isViewAlive]);
1041 }; 1038 };
1042 1039
1043 } // namespace 1040 } // namespace
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.mm ('k') | ios/web/web_state/web_state_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698