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

Unified Diff: net/tools/flip_server/mem_cache_test.cc

Issue 2169503002: Remove flip_server. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/flip_server/mem_cache.cc ('k') | net/tools/flip_server/output_ordering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/flip_server/mem_cache_test.cc
diff --git a/net/tools/flip_server/mem_cache_test.cc b/net/tools/flip_server/mem_cache_test.cc
deleted file mode 100644
index 0ddb74bc90729df867962ad408443d33362e71a7..0000000000000000000000000000000000000000
--- a/net/tools/flip_server/mem_cache_test.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/tools/flip_server/mem_cache.h"
-
-#include "net/tools/balsa/balsa_headers.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace net {
-
-namespace {
-
-class MemoryCacheWithFakeReadToString : public MemoryCache {
- public:
- ~MemoryCacheWithFakeReadToString() override {}
-
- void ReadToString(const char* filename, std::string* output) override {
- *output = data_map_[filename];
- }
-
- std::map<std::string, std::string> data_map_;
-};
-
-class FlipMemoryCacheTest : public ::testing::Test {
- public:
- FlipMemoryCacheTest() : mem_cache_(new MemoryCacheWithFakeReadToString) {}
-
- protected:
- std::unique_ptr<MemoryCacheWithFakeReadToString> mem_cache_;
-};
-
-TEST_F(FlipMemoryCacheTest, EmptyCache) {
- MemCacheIter mci;
- mci.stream_id = 0;
- ASSERT_EQ(NULL, mem_cache_->GetFileData("./foo"));
- ASSERT_EQ(NULL, mem_cache_->GetFileData("./bar"));
- ASSERT_FALSE(mem_cache_->AssignFileData("./hello", &mci));
-}
-
-TEST_F(FlipMemoryCacheTest, ReadAndStoreFileContents) {
- FileData* foo;
- FileData* hello;
-
- mem_cache_->data_map_["./foo"] = "bar";
- mem_cache_->data_map_["./hello"] =
- "HTTP/1.0 200 OK\r\n"
- "key1: value1\r\n"
- "key2: value2\r\n\r\n"
- "body: body\r\n";
- mem_cache_->ReadAndStoreFileContents("./foo");
- mem_cache_->ReadAndStoreFileContents("./hello");
-
- foo = mem_cache_->GetFileData("foo");
- hello = mem_cache_->GetFileData("hello");
-
- // "./foo" content is broken.
- ASSERT_EQ(NULL, foo);
- ASSERT_FALSE(NULL == hello);
- ASSERT_EQ(hello, mem_cache_->GetFileData("hello"));
-
- // "HTTP/1.0" is rewritten to "HTTP/1.1".
- ASSERT_EQ("HTTP/1.1", hello->headers()->response_version());
- ASSERT_EQ("200", hello->headers()->response_code());
- ASSERT_EQ("OK", hello->headers()->response_reason_phrase());
- ASSERT_EQ(4,
- std::distance(hello->headers()->header_lines_begin(),
- hello->headers()->header_lines_end()));
- ASSERT_TRUE(hello->headers()->HasHeader("key1"));
- ASSERT_TRUE(hello->headers()->HasHeader("key2"));
- ASSERT_TRUE(hello->headers()->HasHeader("transfer-encoding"));
- ASSERT_TRUE(hello->headers()->HasHeader("connection"));
- ASSERT_EQ("value1", hello->headers()->GetHeaderPosition("key1")->second);
- ASSERT_EQ("value2", hello->headers()->GetHeaderPosition("key2")->second);
- ASSERT_EQ("chunked",
- hello->headers()->GetHeaderPosition("transfer-encoding")->second);
- ASSERT_EQ("keep-alive",
- hello->headers()->GetHeaderPosition("connection")->second);
- ASSERT_EQ("body: body\r\n", hello->body());
- ASSERT_EQ("hello", hello->filename());
-}
-
-TEST_F(FlipMemoryCacheTest, GetFileDataForHtmlFile) {
- FileData* hello_html;
-
- mem_cache_->data_map_["./hello.http"] =
- "HTTP/1.0 200 OK\r\n"
- "key1: value1\r\n"
- "key2: value2\r\n\r\n"
- "body: body\r\n";
-
- mem_cache_->ReadAndStoreFileContents("./hello.http");
- hello_html = mem_cache_->GetFileData("hello.html");
- ASSERT_FALSE(NULL == hello_html);
- ASSERT_EQ(hello_html, mem_cache_->GetFileData("hello.http"));
-}
-
-} // namespace
-
-} // namespace net
« no previous file with comments | « net/tools/flip_server/mem_cache.cc ('k') | net/tools/flip_server/output_ordering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698