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

Unified Diff: ios/web/web_state/navigation_context_impl_unittest.mm

Issue 2838583002: Added Setters to NavigationContextImpl. (Closed)
Patch Set: Rebased Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/web_state/navigation_context_impl.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/navigation_context_impl_unittest.mm
diff --git a/ios/web/web_state/navigation_context_impl_unittest.mm b/ios/web/web_state/navigation_context_impl_unittest.mm
index 65af1d16e969519e5addfb140660fde3dd24eb5f..9ffedf9a4cd2ff624f9f41146897e63ec5fe4701 100644
--- a/ios/web/web_state/navigation_context_impl_unittest.mm
+++ b/ios/web/web_state/navigation_context_impl_unittest.mm
@@ -30,8 +30,8 @@ class NavigationContextImplTest : public PlatformTest {
scoped_refptr<net::HttpResponseHeaders> response_headers_;
};
-// Tests CreateNavigationContext factory method.
-TEST_F(NavigationContextImplTest, NavigationContext) {
+// Tests legacy CreateNavigationContext factory method.
+TEST_F(NavigationContextImplTest, LegacyNavigationContext) {
std::unique_ptr<NavigationContext> context =
NavigationContextImpl::CreateNavigationContext(&web_state_, url_,
response_headers_);
@@ -44,6 +44,19 @@ TEST_F(NavigationContextImplTest, NavigationContext) {
EXPECT_EQ(response_headers_.get(), context->GetResponseHeaders());
}
+// Tests CreateNavigationContext factory method.
+TEST_F(NavigationContextImplTest, NavigationContext) {
+ std::unique_ptr<NavigationContext> context =
+ NavigationContextImpl::CreateNavigationContext(&web_state_, url_);
+ ASSERT_TRUE(context);
+
+ EXPECT_EQ(&web_state_, context->GetWebState());
+ EXPECT_EQ(url_, context->GetUrl());
+ EXPECT_FALSE(context->IsSameDocument());
+ EXPECT_FALSE(context->IsErrorPage());
+ EXPECT_FALSE(context->GetResponseHeaders());
+}
+
// Tests CreateSameDocumentNavigationContext factory method.
TEST_F(NavigationContextImplTest, SameDocumentNavigationContext) {
std::unique_ptr<NavigationContext> context =
@@ -72,4 +85,33 @@ TEST_F(NavigationContextImplTest, ErrorPageNavigationContext) {
EXPECT_EQ(response_headers_.get(), context->GetResponseHeaders());
}
+// Tests NavigationContextImpl Setters.
+TEST_F(NavigationContextImplTest, Setters) {
+ std::unique_ptr<NavigationContextImpl> context =
+ NavigationContextImpl::CreateNavigationContext(&web_state_, url_);
+ ASSERT_TRUE(context);
+
+ ASSERT_FALSE(context->IsSameDocument());
+ ASSERT_FALSE(context->IsErrorPage());
+ ASSERT_NE(response_headers_.get(), context->GetResponseHeaders());
+
+ // SetSameDocument
+ context->SetIsSameDocument(true);
+ EXPECT_TRUE(context->IsSameDocument());
+ EXPECT_FALSE(context->IsErrorPage());
+ EXPECT_NE(response_headers_.get(), context->GetResponseHeaders());
+
+ // SetErrorPage
+ context->SetIsErrorPage(true);
+ EXPECT_TRUE(context->IsSameDocument());
+ EXPECT_TRUE(context->IsErrorPage());
+ EXPECT_NE(response_headers_.get(), context->GetResponseHeaders());
+
+ // SetResponseHeaders
+ context->SetResponseHeaders(response_headers_);
+ EXPECT_TRUE(context->IsSameDocument());
+ EXPECT_TRUE(context->IsErrorPage());
+ EXPECT_EQ(response_headers_.get(), context->GetResponseHeaders());
+}
+
} // namespace web
« no previous file with comments | « ios/web/web_state/navigation_context_impl.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698