| Index: components/cronet/ios/test/quic_test_server.cc
|
| diff --git a/components/cronet/ios/test/quic_test_server.cc b/components/cronet/ios/test/quic_test_server.cc
|
| index 581d737b8a099434e443c23af0dcbbe160c8cb9c..4f0dfacc41f319d64894bf34fbf6264b7c403df1 100644
|
| --- a/components/cronet/ios/test/quic_test_server.cc
|
| +++ b/components/cronet/ios/test/quic_test_server.cc
|
| @@ -13,6 +13,7 @@
|
| #include "net/base/ip_endpoint.h"
|
| #include "net/base/test_data_directory.h"
|
| #include "net/quic/crypto/proof_source_chromium.h"
|
| +#include "net/spdy/spdy_header_block.h"
|
| #include "net/tools/quic/quic_in_memory_cache.h"
|
| #include "net/tools/quic/quic_simple_server.h"
|
|
|
| @@ -20,8 +21,22 @@ namespace cronet {
|
|
|
| // This must match the certificate used (quic_test.example.com.crt and
|
| // quic_test.example.com.key.pkcs8).
|
| -const char kFakeQuicDomain[] = "test.example.com";
|
| -static const int kServerPort = 6121;
|
| +const char kTestServerDomain[] = "test.example.com";
|
| +const int kTestServerPort = 6121;
|
| +const char kTestServerHost[] = "test.example.com:6121";
|
| +const char kTestServerUrl[] = "https://test.example.com:6121/hello.txt";
|
| +
|
| +const char kStatusHeader[] = ":status";
|
| +
|
| +const char kHelloPath[] = "/hello.txt";
|
| +const char kHelloBodyValue[] = "Hello from QUIC Server";
|
| +const char kHelloStatus[] = "200";
|
| +
|
| +const char kHelloHeaderName[] = "hello_header";
|
| +const char kHelloHeaderValue[] = "hello header value";
|
| +
|
| +const char kHelloTrailerName[] = "hello_trailer";
|
| +const char kHelloTrailerValue[] = "hello trailer value";
|
|
|
| base::Thread* g_quic_server_thread = nullptr;
|
| net::QuicSimpleServer* g_quic_server = nullptr;
|
| @@ -32,20 +47,20 @@ void StartQuicServerOnServerThread(const base::FilePath& test_files_root,
|
| DCHECK(!g_quic_server);
|
|
|
| // Set up in-memory cache.
|
| - /*
|
| - base::FilePath file_dir = test_files_root.Append("quic_data");
|
| - CHECK(base::PathExists(file_dir)) << "Quic data does not exist";
|
| - net::QuicInMemoryCache::GetInstance()->InitializeFromDirectory(
|
| - file_dir.value());
|
| - */
|
| + net::SpdyHeaderBlock headers;
|
| + headers.ReplaceOrAppendHeader(kHelloHeaderName, kHelloHeaderValue);
|
| + headers.ReplaceOrAppendHeader(kStatusHeader, kHelloStatus);
|
| + net::SpdyHeaderBlock trailers;
|
| + trailers.ReplaceOrAppendHeader(kHelloTrailerName, kHelloTrailerValue);
|
| + net::QuicInMemoryCache::GetInstance()->AddResponse(
|
| + kTestServerHost, kHelloPath, headers, kHelloBodyValue, trailers);
|
| +
|
| net::IPAddressNumber ip;
|
| - net::ParseIPLiteralToNumber(kFakeQuicDomain, &ip);
|
| + net::ParseIPLiteralToNumber(kTestServerDomain, &ip);
|
| net::QuicConfig config;
|
|
|
| // Set up server certs.
|
| base::FilePath directory;
|
| - // CHECK(base::android::GetExternalStorageDirectory(&directory));
|
| - // directory = directory.Append("net/data/ssl/certificates");
|
| directory = test_files_root;
|
| // TODO(xunjieli): Use scoped_ptr when crbug.com/545474 is fixed.
|
| net::ProofSourceChromium* proof_source = new net::ProofSourceChromium();
|
| @@ -57,7 +72,7 @@ void StartQuicServerOnServerThread(const base::FilePath& test_files_root,
|
| net::QuicSupportedVersions());
|
|
|
| // Start listening.
|
| - int rv = g_quic_server->Listen(net::IPEndPoint(ip, kServerPort));
|
| + int rv = g_quic_server->Listen(net::IPEndPoint(ip, kTestServerPort));
|
| CHECK_GE(rv, 0) << "Quic server fails to start";
|
| server_started_event->Signal();
|
| }
|
|
|