| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (!request_info) return false; | 66 if (!request_info) return false; |
| 67 | 67 |
| 68 std::string encoding_headers; | 68 std::string encoding_headers; |
| 69 bool get_success = request_info->extra_headers.GetHeader( | 69 bool get_success = request_info->extra_headers.GetHeader( |
| 70 "Accept-Encoding", &encoding_headers); | 70 "Accept-Encoding", &encoding_headers); |
| 71 EXPECT_TRUE(get_success); | 71 EXPECT_TRUE(get_success); |
| 72 if (!get_success) return false; | 72 if (!get_success) return false; |
| 73 | 73 |
| 74 // This check isn't wrapped with EXPECT* macros because different | 74 // This check isn't wrapped with EXPECT* macros because different |
| 75 // results from this function may be expected in different tests. | 75 // results from this function may be expected in different tests. |
| 76 std::vector<std::string> tokens; | 76 for (const std::string& token : |
| 77 size_t num_tokens = Tokenize(encoding_headers, ", ", &tokens); | 77 base::SplitString(encoding_headers, ", ", base::KEEP_WHITESPACE, |
| 78 for (size_t i = 0; i < num_tokens; i++) { | 78 base::SPLIT_WANT_NONEMPTY)) { |
| 79 if (!base::strncasecmp(tokens[i].data(), "sdch", tokens[i].length())) | 79 if (!strncasecmp(token.data(), "sdch", token.length())) |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 return false; | 82 return false; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void EnableSdch() { | 85 void EnableSdch() { |
| 86 context_.SetSdchManager(scoped_ptr<SdchManager>(new SdchManager).Pass()); | 86 context_.SetSdchManager(scoped_ptr<SdchManager>(new SdchManager).Pass()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 MockNetworkLayer network_layer_; | 89 MockNetworkLayer network_layer_; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 req_->SetLoadFlags(LOAD_DISABLE_CACHE); | 342 req_->SetLoadFlags(LOAD_DISABLE_CACHE); |
| 343 job->Start(); | 343 job->Start(); |
| 344 base::RunLoop().RunUntilIdle(); | 344 base::RunLoop().RunUntilIdle(); |
| 345 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_->status().status()); | 345 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_->status().status()); |
| 346 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); | 346 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace | 349 } // namespace |
| 350 | 350 |
| 351 } // namespace net | 351 } // namespace net |
| OLD | NEW |