Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 #endif | 10 #endif |
| (...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3053 EXPECT_TRUE(headers->GetNormalizedHeader("content-type", &header)); | 3053 EXPECT_TRUE(headers->GetNormalizedHeader("content-type", &header)); |
| 3054 EXPECT_EQ("text/html; charset=ISO-8859-1", header); | 3054 EXPECT_EQ("text/html; charset=ISO-8859-1", header); |
| 3055 | 3055 |
| 3056 // The response has two "X-Multiple-Entries" headers. | 3056 // The response has two "X-Multiple-Entries" headers. |
| 3057 // This verfies our output has them concatenated together. | 3057 // This verfies our output has them concatenated together. |
| 3058 header.clear(); | 3058 header.clear(); |
| 3059 EXPECT_TRUE(headers->GetNormalizedHeader("x-multiple-entries", &header)); | 3059 EXPECT_TRUE(headers->GetNormalizedHeader("x-multiple-entries", &header)); |
| 3060 EXPECT_EQ("a, b", header); | 3060 EXPECT_EQ("a, b", header); |
| 3061 } | 3061 } |
| 3062 | 3062 |
| 3063 TEST_F(URLRequestTest, ProcessSTSOnce) { | |
|
Ryan Sleevi
2012/10/18 19:45:34
nit: name this URLRequestTestHTTP
palmer
2012/10/18 21:01:58
Done.
| |
| 3064 TestServer https_test_server( | |
| 3065 TestServer::TYPE_HTTPS, | |
| 3066 TestServer::kLocalhost, | |
| 3067 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); | |
| 3068 ASSERT_TRUE(https_test_server.Start()); | |
| 3069 | |
| 3070 TestDelegate d; | |
| 3071 URLRequest request( | |
| 3072 https_test_server.GetURL("files/hsts-headers.html"), | |
| 3073 &d, | |
| 3074 &default_context_); | |
| 3075 request.Start(); | |
| 3076 MessageLoop::current()->Run(); | |
| 3077 | |
| 3078 // We should have set parameters from the first header, not the second. | |
| 3079 TransportSecurityState* security_state = | |
| 3080 default_context_.transport_security_state(); | |
| 3081 bool sni_available = true; | |
| 3082 TransportSecurityState::DomainState domain_state; | |
| 3083 EXPECT_TRUE(security_state->GetDomainState( | |
| 3084 TestServer::kLocalhost, sni_available, &domain_state)); | |
| 3085 EXPECT_EQ(TransportSecurityState::DomainState::MODE_FORCE_HTTPS, | |
| 3086 domain_state.upgrade_mode); | |
| 3087 EXPECT_FALSE(domain_state.include_subdomains); | |
|
Ryan Sleevi
2012/10/18 19:45:34
test nit: I would suggest adding a positive test t
palmer
2012/10/18 21:01:58
Done.
| |
| 3088 } | |
| 3089 | |
| 3063 TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { | 3090 TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { |
| 3064 ASSERT_TRUE(test_server_.Start()); | 3091 ASSERT_TRUE(test_server_.Start()); |
| 3065 | 3092 |
| 3066 TestDelegate d; | 3093 TestDelegate d; |
| 3067 URLRequest req(test_server_.GetURL( | 3094 URLRequest req(test_server_.GetURL( |
| 3068 "files/content-type-normalization.html"), &d, &default_context_); | 3095 "files/content-type-normalization.html"), &d, &default_context_); |
| 3069 req.Start(); | 3096 req.Start(); |
| 3070 MessageLoop::current()->Run(); | 3097 MessageLoop::current()->Run(); |
| 3071 | 3098 |
| 3072 std::string mime_type; | 3099 std::string mime_type; |
| (...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4833 | 4860 |
| 4834 EXPECT_FALSE(r.is_pending()); | 4861 EXPECT_FALSE(r.is_pending()); |
| 4835 EXPECT_EQ(1, d->response_started_count()); | 4862 EXPECT_EQ(1, d->response_started_count()); |
| 4836 EXPECT_FALSE(d->received_data_before_response()); | 4863 EXPECT_FALSE(d->received_data_before_response()); |
| 4837 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 4864 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
| 4838 } | 4865 } |
| 4839 } | 4866 } |
| 4840 #endif // !defined(DISABLE_FTP_SUPPORT) | 4867 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 4841 | 4868 |
| 4842 } // namespace net | 4869 } // namespace net |
| OLD | NEW |