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 "net/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 0, | 456 0, |
457 0, | 457 0, |
458 OK}; | 458 OK}; |
459 | 459 |
460 const char kFullRangeData[] = | 460 const char kFullRangeData[] = |
461 "rg: 00-09 rg: 10-19 rg: 20-29 rg: 30-39 " | 461 "rg: 00-09 rg: 10-19 rg: 20-29 rg: 30-39 " |
462 "rg: 40-49 rg: 50-59 rg: 60-69 rg: 70-79 "; | 462 "rg: 40-49 rg: 50-59 rg: 60-69 rg: 70-79 "; |
463 | 463 |
464 // Verifies the response headers (|response|) match a partial content | 464 // Verifies the response headers (|response|) match a partial content |
465 // response for the range starting at |start| and ending at |end|. | 465 // response for the range starting at |start| and ending at |end|. |
466 void Verify206Response(std::string response, int start, int end) { | 466 void Verify206Response(const std::string& response, int start, int end) { |
467 std::string raw_headers( | 467 std::string raw_headers( |
468 HttpUtil::AssembleRawHeaders(response.data(), response.size())); | 468 HttpUtil::AssembleRawHeaders(response.data(), response.size())); |
469 scoped_refptr<HttpResponseHeaders> headers( | 469 scoped_refptr<HttpResponseHeaders> headers( |
470 new HttpResponseHeaders(raw_headers)); | 470 new HttpResponseHeaders(raw_headers)); |
471 | 471 |
472 ASSERT_EQ(206, headers->response_code()); | 472 ASSERT_EQ(206, headers->response_code()); |
473 | 473 |
474 int64 range_start, range_end, object_size; | 474 int64 range_start, range_end, object_size; |
475 ASSERT_TRUE( | 475 ASSERT_TRUE( |
476 headers->GetContentRange(&range_start, &range_end, &object_size)); | 476 headers->GetContentRange(&range_start, &range_end, &object_size)); |
(...skipping 7215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7692 EXPECT_EQ(1, cache.disk_cache()->open_count()); | 7692 EXPECT_EQ(1, cache.disk_cache()->open_count()); |
7693 EXPECT_EQ(1, cache.disk_cache()->create_count()); | 7693 EXPECT_EQ(1, cache.disk_cache()->create_count()); |
7694 EXPECT_TRUE(response_info.was_cached); | 7694 EXPECT_TRUE(response_info.was_cached); |
7695 | 7695 |
7696 // The new SSL state is reported. | 7696 // The new SSL state is reported. |
7697 EXPECT_EQ(status2, response_info.ssl_info.connection_status); | 7697 EXPECT_EQ(status2, response_info.ssl_info.connection_status); |
7698 EXPECT_TRUE(cert2->Equals(response_info.ssl_info.cert.get())); | 7698 EXPECT_TRUE(cert2->Equals(response_info.ssl_info.cert.get())); |
7699 } | 7699 } |
7700 | 7700 |
7701 } // namespace net | 7701 } // namespace net |
OLD | NEW |