OLD | NEW |
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" |
11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
12 namespace web { | 16 namespace web { |
13 namespace { | 17 namespace { |
14 const char kRawResponseHeaders[] = | 18 const char kRawResponseHeaders[] = |
15 "HTTP/1.1 200 OK\0" | 19 "HTTP/1.1 200 OK\0" |
16 "Content-Length: 450\0" | 20 "Content-Length: 450\0" |
17 "Connection: keep-alive\0"; | 21 "Connection: keep-alive\0"; |
18 } // namespace | 22 } // namespace |
19 | 23 |
20 // Test fixture for NavigationContextImplTest testing. | 24 // Test fixture for NavigationContextImplTest testing. |
21 class NavigationContextImplTest : public PlatformTest { | 25 class NavigationContextImplTest : public PlatformTest { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders()); | 71 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders()); |
68 | 72 |
69 // SetPost | 73 // SetPost |
70 context->SetIsPost(true); | 74 context->SetIsPost(true); |
71 EXPECT_TRUE(context->IsSameDocument()); | 75 EXPECT_TRUE(context->IsSameDocument()); |
72 ASSERT_TRUE(context->IsPost()); | 76 ASSERT_TRUE(context->IsPost()); |
73 EXPECT_FALSE(context->GetError()); | 77 EXPECT_FALSE(context->GetError()); |
74 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders()); | 78 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders()); |
75 | 79 |
76 // SetErrorPage | 80 // SetErrorPage |
77 NSError* error = [[[NSError alloc] init] autorelease]; | 81 NSError* error = [[NSError alloc] init]; |
78 context->SetError(error); | 82 context->SetError(error); |
79 EXPECT_TRUE(context->IsSameDocument()); | 83 EXPECT_TRUE(context->IsSameDocument()); |
80 ASSERT_TRUE(context->IsPost()); | 84 ASSERT_TRUE(context->IsPost()); |
81 EXPECT_EQ(error, context->GetError()); | 85 EXPECT_EQ(error, context->GetError()); |
82 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders()); | 86 EXPECT_NE(response_headers_.get(), context->GetResponseHeaders()); |
83 | 87 |
84 // SetResponseHeaders | 88 // SetResponseHeaders |
85 context->SetResponseHeaders(response_headers_); | 89 context->SetResponseHeaders(response_headers_); |
86 EXPECT_TRUE(context->IsSameDocument()); | 90 EXPECT_TRUE(context->IsSameDocument()); |
87 ASSERT_TRUE(context->IsPost()); | 91 ASSERT_TRUE(context->IsPost()); |
88 EXPECT_EQ(error, context->GetError()); | 92 EXPECT_EQ(error, context->GetError()); |
89 EXPECT_EQ(response_headers_.get(), context->GetResponseHeaders()); | 93 EXPECT_EQ(response_headers_.get(), context->GetResponseHeaders()); |
90 } | 94 } |
91 | 95 |
92 } // namespace web | 96 } // namespace web |
OLD | NEW |