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

Side by Side Diff: net/tools/quic/quic_in_memory_cache_test.cc

Issue 24596008: Cleanup of QuicInMemoryCache to sync with internal version. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing files Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <string> 5 #include <string>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_piece.h" 11 #include "base/strings/string_piece.h"
12 #include "net/tools/flip_server/balsa_headers.h" 12 #include "net/tools/flip_server/balsa_headers.h"
13 #include "net/tools/quic/quic_in_memory_cache.h" 13 #include "net/tools/quic/quic_in_memory_cache.h"
14 #include "net/tools/quic/test_tools/quic_in_memory_cache_peer.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 using base::IntToString; 17 using base::IntToString;
17 using base::StringPiece; 18 using base::StringPiece;
18 19
19 namespace net { 20 namespace net {
20 namespace tools { 21 namespace tools {
21 namespace test { 22 namespace test {
22 23
23 class QuicInMemoryCacheTest : public ::testing::Test { 24 class QuicInMemoryCacheTest : public ::testing::Test {
24 protected: 25 protected:
25 QuicInMemoryCacheTest() { 26 QuicInMemoryCacheTest() {
26 base::FilePath path; 27 base::FilePath path;
27 PathService::Get(base::DIR_SOURCE_ROOT, &path); 28 PathService::Get(base::DIR_SOURCE_ROOT, &path);
28 path = path.AppendASCII("net").AppendASCII("data") 29 path = path.AppendASCII("net").AppendASCII("data")
29 .AppendASCII("quic_in_memory_cache_data"); 30 .AppendASCII("quic_in_memory_cache_data");
30 // The file path is known to be an ascii string. 31 // The file path is known to be an ascii string.
31 FLAGS_quic_in_memory_cache_dir = path.MaybeAsASCII(); 32 FLAGS_quic_in_memory_cache_dir = path.MaybeAsASCII();
32 } 33 }
33 34
34 void CreateRequest(std::string host, 35 void CreateRequest(std::string host,
35 std::string path, 36 std::string path,
36 net::BalsaHeaders* headers) { 37 net::BalsaHeaders* headers) {
37 headers->SetRequestFirstlineFromStringPieces("GET", path, "HTTP/1.1"); 38 headers->SetRequestFirstlineFromStringPieces("GET", path, "HTTP/1.1");
38 headers->ReplaceOrAppendHeader("host", host); 39 headers->ReplaceOrAppendHeader("host", host);
39 } 40 }
40 41
41 virtual void SetUp() { 42 virtual void SetUp() {
42 QuicInMemoryCache::GetInstance()->ResetForTests(); 43 QuicInMemoryCachePeer::ResetForTests();
43 } 44 }
44 45
45 // This method was copied from end_to_end_test.cc in this directory. 46 // This method was copied from end_to_end_test.cc in this directory.
46 void AddToCache(const StringPiece& method, 47 void AddToCache(const StringPiece& method,
47 const StringPiece& path, 48 const StringPiece& path,
48 const StringPiece& version, 49 const StringPiece& version,
49 const StringPiece& response_code, 50 const StringPiece& response_code,
50 const StringPiece& response_detail, 51 const StringPiece& response_detail,
51 const StringPiece& body) { 52 const StringPiece& body) {
52 BalsaHeaders request_headers, response_headers; 53 BalsaHeaders request_headers, response_headers;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 CreateRequest("www.google.com", "/index.html", &request_headers); 129 CreateRequest("www.google.com", "/index.html", &request_headers);
129 130
130 const QuicInMemoryCache::Response* response = 131 const QuicInMemoryCache::Response* response =
131 QuicInMemoryCache::GetInstance()->GetResponse(request_headers); 132 QuicInMemoryCache::GetInstance()->GetResponse(request_headers);
132 ASSERT_FALSE(response); 133 ASSERT_FALSE(response);
133 } 134 }
134 135
135 } // namespace test 136 } // namespace test
136 } // namespace tools 137 } // namespace tools
137 } // namespace net 138 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.cc ('k') | net/tools/quic/quic_reliable_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698