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

Side by Side Diff: net/tools/flip_server/mem_cache_test.cc

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu Created 4 years, 8 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
« no previous file with comments | « net/tools/flip_server/mem_cache.cc ('k') | net/tools/flip_server/ring_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/tools/flip_server/mem_cache.h" 5 #include "net/tools/flip_server/mem_cache.h"
6 6
7 #include "net/tools/balsa/balsa_headers.h" 7 #include "net/tools/balsa/balsa_headers.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 namespace { 12 namespace {
13 13
14 class MemoryCacheWithFakeReadToString : public MemoryCache { 14 class MemoryCacheWithFakeReadToString : public MemoryCache {
15 public: 15 public:
16 ~MemoryCacheWithFakeReadToString() override {} 16 ~MemoryCacheWithFakeReadToString() override {}
17 17
18 void ReadToString(const char* filename, std::string* output) override { 18 void ReadToString(const char* filename, std::string* output) override {
19 *output = data_map_[filename]; 19 *output = data_map_[filename];
20 } 20 }
21 21
22 std::map<std::string, std::string> data_map_; 22 std::map<std::string, std::string> data_map_;
23 }; 23 };
24 24
25 class FlipMemoryCacheTest : public ::testing::Test { 25 class FlipMemoryCacheTest : public ::testing::Test {
26 public: 26 public:
27 FlipMemoryCacheTest() : mem_cache_(new MemoryCacheWithFakeReadToString) {} 27 FlipMemoryCacheTest() : mem_cache_(new MemoryCacheWithFakeReadToString) {}
28 28
29 protected: 29 protected:
30 scoped_ptr<MemoryCacheWithFakeReadToString> mem_cache_; 30 std::unique_ptr<MemoryCacheWithFakeReadToString> mem_cache_;
31 }; 31 };
32 32
33 TEST_F(FlipMemoryCacheTest, EmptyCache) { 33 TEST_F(FlipMemoryCacheTest, EmptyCache) {
34 MemCacheIter mci; 34 MemCacheIter mci;
35 mci.stream_id = 0; 35 mci.stream_id = 0;
36 ASSERT_EQ(NULL, mem_cache_->GetFileData("./foo")); 36 ASSERT_EQ(NULL, mem_cache_->GetFileData("./foo"));
37 ASSERT_EQ(NULL, mem_cache_->GetFileData("./bar")); 37 ASSERT_EQ(NULL, mem_cache_->GetFileData("./bar"));
38 ASSERT_FALSE(mem_cache_->AssignFileData("./hello", &mci)); 38 ASSERT_FALSE(mem_cache_->AssignFileData("./hello", &mci));
39 } 39 }
40 40
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 mem_cache_->ReadAndStoreFileContents("./hello.http"); 92 mem_cache_->ReadAndStoreFileContents("./hello.http");
93 hello_html = mem_cache_->GetFileData("hello.html"); 93 hello_html = mem_cache_->GetFileData("hello.html");
94 ASSERT_FALSE(NULL == hello_html); 94 ASSERT_FALSE(NULL == hello_html);
95 ASSERT_EQ(hello_html, mem_cache_->GetFileData("hello.http")); 95 ASSERT_EQ(hello_html, mem_cache_->GetFileData("hello.http"));
96 } 96 }
97 97
98 } // namespace 98 } // namespace
99 99
100 } // namespace net 100 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/flip_server/mem_cache.cc ('k') | net/tools/flip_server/ring_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698