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

Side by Side Diff: ios/web/web_state/navigation_context_impl_unittest.mm

Issue 2903883002: Added NavigationContext::IsPost. (Closed)
Patch Set: Self review Created 3 years, 6 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/navigation_context_impl.h" 5 #import "ios/web/web_state/navigation_context_impl.h"
6 6
7 #import "ios/web/public/test/fakes/test_web_state.h" 7 #import "ios/web/public/test/fakes/test_web_state.h"
8 #include "net/http/http_response_headers.h" 8 #include "net/http/http_response_headers.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h" 10 #include "testing/platform_test.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 // Tests NavigationContextImpl Setters. 50 // Tests NavigationContextImpl Setters.
51 TEST_F(NavigationContextImplTest, Setters) { 51 TEST_F(NavigationContextImplTest, Setters) {
52 std::unique_ptr<NavigationContextImpl> context = 52 std::unique_ptr<NavigationContextImpl> context =
53 NavigationContextImpl::CreateNavigationContext( 53 NavigationContextImpl::CreateNavigationContext(
54 &web_state_, url_, ui::PageTransition::PAGE_TRANSITION_FORWARD_BACK); 54 &web_state_, url_, ui::PageTransition::PAGE_TRANSITION_FORWARD_BACK);
55 ASSERT_TRUE(context); 55 ASSERT_TRUE(context);
56 56
57 ASSERT_FALSE(context->IsSameDocument()); 57 ASSERT_FALSE(context->IsSameDocument());
58 ASSERT_FALSE(context->IsPost());
58 ASSERT_FALSE(context->GetError()); 59 ASSERT_FALSE(context->GetError());
59 ASSERT_NE(response_headers_.get(), context->GetResponseHeaders()); 60 ASSERT_NE(response_headers_.get(), context->GetResponseHeaders());
60 61
61 // SetSameDocument 62 // SetSameDocument
62 context->SetIsSameDocument(true); 63 context->SetIsSameDocument(true);
63 EXPECT_TRUE(context->IsSameDocument()); 64 EXPECT_TRUE(context->IsSameDocument());
65 ASSERT_FALSE(context->IsPost());
64 EXPECT_FALSE(context->GetError()); 66 EXPECT_FALSE(context->GetError());
65 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders()); 67 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders());
66 68
69 // SetPost
70 context->SetIsPost(true);
71 EXPECT_TRUE(context->IsSameDocument());
72 ASSERT_TRUE(context->IsPost());
73 EXPECT_FALSE(context->GetError());
74 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders());
75
67 // SetErrorPage 76 // SetErrorPage
68 NSError* error = [[[NSError alloc] init] autorelease]; 77 NSError* error = [[[NSError alloc] init] autorelease];
69 context->SetError(error); 78 context->SetError(error);
70 EXPECT_TRUE(context->IsSameDocument()); 79 EXPECT_TRUE(context->IsSameDocument());
80 ASSERT_TRUE(context->IsPost());
71 EXPECT_EQ(error, context->GetError()); 81 EXPECT_EQ(error, context->GetError());
72 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders()); 82 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders());
73 83
74 // SetResponseHeaders 84 // SetResponseHeaders
75 context->SetResponseHeaders(response_headers_); 85 context->SetResponseHeaders(response_headers_);
76 EXPECT_TRUE(context->IsSameDocument()); 86 EXPECT_TRUE(context->IsSameDocument());
87 ASSERT_TRUE(context->IsPost());
77 EXPECT_EQ(error, context->GetError()); 88 EXPECT_EQ(error, context->GetError());
78 EXPECT_EQ(response_headers_.get(), context->GetResponseHeaders()); 89 EXPECT_EQ(response_headers_.get(), context->GetResponseHeaders());
79 } 90 }
80 91
81 } // namespace web 92 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/navigation_context_impl.mm ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698