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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/ui/crw_web_controller_unittest.mm
diff --git a/ios/web/web_state/ui/crw_web_controller_unittest.mm b/ios/web/web_state/ui/crw_web_controller_unittest.mm
index 1526b068e11234dfd68495d839e620524b93ed6d..c260ab6ab0335f390ca4e39c046374c0c11aefe7 100644
--- a/ios/web/web_state/ui/crw_web_controller_unittest.mm
+++ b/ios/web/web_state/ui/crw_web_controller_unittest.mm
@@ -889,6 +889,29 @@ TEST_F(CRWWebControllerNativeContentTest, NativeContentVirtualURL) {
virtual_url);
}
+// Tests WebState and NavigationManager correctly return native content URL.
+TEST_F(CRWWebControllerNativeContentTest, FallbackNativeContentURL) {
+ GURL url_to_load(kTestURLString);
+ GURL fallback_url(kTestAppSpecificURL);
+ base::scoped_nsobject<TestNativeContent> content([[TestNativeContent alloc]
+ initWithURL:fallback_url
+ virtualURL:url_to_load]);
+ [mock_native_provider_ setController:content forURL:fallback_url];
+ Load(url_to_load);
+ web::URLVerificationTrustLevel trust_level = web::kNone;
+ [web_controller() loadNativeContentFallback:fallback_url];
+ GURL gurl = [web_controller() currentURLWithTrustLevel:&trust_level];
+ EXPECT_EQ(web::kAbsolute, trust_level);
+ EXPECT_EQ([web_controller() webState]->GetVisibleURL(), url_to_load);
+ NavigationManagerImpl& navigationManager =
+ [web_controller() webStateImpl]->GetNavigationManagerImpl();
+ EXPECT_EQ(navigationManager.GetVisibleItem()->GetURL(), url_to_load);
+ EXPECT_EQ(navigationManager.GetVisibleItem()->GetVirtualURL(), url_to_load);
+ EXPECT_EQ(navigationManager.GetLastCommittedItem()->GetURL(), url_to_load);
+ EXPECT_EQ(navigationManager.GetLastCommittedItem()->GetVirtualURL(),
+ url_to_load);
+}
+
// A separate test class, as none of the |CRWUIWebViewWebControllerTest| setup
// is needed;
typedef web::WebTestWithWebController CRWWebControllerObserversTest;
« 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