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

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

Issue 2578973002: Reload offline version on load failure (Closed)
Patch Set: clean Created 4 years 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 EXPECT_EQ([web_controller() webState]->GetVisibleURL(), virtual_url); 882 EXPECT_EQ([web_controller() webState]->GetVisibleURL(), virtual_url);
883 NavigationManagerImpl& navigationManager = 883 NavigationManagerImpl& navigationManager =
884 [web_controller() webStateImpl]->GetNavigationManagerImpl(); 884 [web_controller() webStateImpl]->GetNavigationManagerImpl();
885 EXPECT_EQ(navigationManager.GetVisibleItem()->GetURL(), url_to_load); 885 EXPECT_EQ(navigationManager.GetVisibleItem()->GetURL(), url_to_load);
886 EXPECT_EQ(navigationManager.GetVisibleItem()->GetVirtualURL(), virtual_url); 886 EXPECT_EQ(navigationManager.GetVisibleItem()->GetVirtualURL(), virtual_url);
887 EXPECT_EQ(navigationManager.GetLastCommittedItem()->GetURL(), url_to_load); 887 EXPECT_EQ(navigationManager.GetLastCommittedItem()->GetURL(), url_to_load);
888 EXPECT_EQ(navigationManager.GetLastCommittedItem()->GetVirtualURL(), 888 EXPECT_EQ(navigationManager.GetLastCommittedItem()->GetVirtualURL(),
889 virtual_url); 889 virtual_url);
890 } 890 }
891 891
892 // Tests WebState and NavigationManager correctly return native content URL.
893 TEST_F(CRWWebControllerNativeContentTest, FallbackNativeContentURL) {
894 GURL url_to_load(kTestURLString);
895 GURL fallback_url(kTestAppSpecificURL);
896 base::scoped_nsobject<TestNativeContent> content([[TestNativeContent alloc]
897 initWithURL:fallback_url
898 virtualURL:url_to_load]);
899 [mock_native_provider_ setController:content forURL:fallback_url];
900 Load(url_to_load);
901 web::URLVerificationTrustLevel trust_level = web::kNone;
902 [web_controller() loadNativeContentFallback:fallback_url];
903 GURL gurl = [web_controller() currentURLWithTrustLevel:&trust_level];
904 EXPECT_EQ(web::kAbsolute, trust_level);
905 EXPECT_EQ([web_controller() webState]->GetVisibleURL(), url_to_load);
906 NavigationManagerImpl& navigationManager =
907 [web_controller() webStateImpl]->GetNavigationManagerImpl();
908 EXPECT_EQ(navigationManager.GetVisibleItem()->GetURL(), url_to_load);
909 EXPECT_EQ(navigationManager.GetVisibleItem()->GetVirtualURL(), url_to_load);
910 EXPECT_EQ(navigationManager.GetLastCommittedItem()->GetURL(), url_to_load);
911 EXPECT_EQ(navigationManager.GetLastCommittedItem()->GetVirtualURL(),
912 url_to_load);
913 }
914
892 // A separate test class, as none of the |CRWUIWebViewWebControllerTest| setup 915 // A separate test class, as none of the |CRWUIWebViewWebControllerTest| setup
893 // is needed; 916 // is needed;
894 typedef web::WebTestWithWebController CRWWebControllerObserversTest; 917 typedef web::WebTestWithWebController CRWWebControllerObserversTest;
895 918
896 // Tests that CRWWebControllerObservers are called. 919 // Tests that CRWWebControllerObservers are called.
897 TEST_F(CRWWebControllerObserversTest, Observers) { 920 TEST_F(CRWWebControllerObserversTest, Observers) {
898 base::scoped_nsobject<CountingObserver> observer( 921 base::scoped_nsobject<CountingObserver> observer(
899 [[CountingObserver alloc] init]); 922 [[CountingObserver alloc] init]);
900 EXPECT_EQ(0u, [web_controller() observerCount]); 923 EXPECT_EQ(0u, [web_controller() observerCount]);
901 [web_controller() addObserver:observer]; 924 [web_controller() addObserver:observer];
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 1096
1074 [web_controller() setDelegate:delegate]; 1097 [web_controller() setDelegate:delegate];
1075 web::SimulateWKWebViewCrash(webView_); 1098 web::SimulateWKWebViewCrash(webView_);
1076 1099
1077 EXPECT_OCMOCK_VERIFY(delegate); 1100 EXPECT_OCMOCK_VERIFY(delegate);
1078 EXPECT_FALSE([web_controller() isViewAlive]); 1101 EXPECT_FALSE([web_controller() isViewAlive]);
1079 [web_controller() setDelegate:nil]; 1102 [web_controller() setDelegate:nil];
1080 }; 1103 };
1081 1104
1082 } // namespace 1105 } // namespace
OLDNEW
« ios/web/web_state/ui/crw_web_controller.h ('K') | « ios/web/web_state/ui/crw_web_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698