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

Side by Side Diff: net/http/http_cache_unittest.cc

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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 (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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698