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

Side by Side Diff: net/tools/flip_server/http_interface_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/http_interface.h ('k') | net/tools/flip_server/mem_cache.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/http_interface.h" 5 #include "net/tools/flip_server/http_interface.h"
6 6
7 #include <list> 7 #include <list>
8 #include <memory>
8 9
9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/strings/string_piece.h" 11 #include "base/strings/string_piece.h"
12 #include "net/tools/balsa/balsa_enums.h" 12 #include "net/tools/balsa/balsa_enums.h"
13 #include "net/tools/balsa/balsa_frame.h" 13 #include "net/tools/balsa/balsa_frame.h"
14 #include "net/tools/balsa/balsa_headers.h" 14 #include "net/tools/balsa/balsa_headers.h"
15 #include "net/tools/flip_server/flip_config.h" 15 #include "net/tools/flip_server/flip_config.h"
16 #include "net/tools/flip_server/flip_test_utils.h" 16 #include "net/tools/flip_server/flip_test_utils.h"
17 #include "net/tools/flip_server/mem_cache.h" 17 #include "net/tools/flip_server/mem_cache.h"
18 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 acceptor_->listen_fd_ = -1; 93 acceptor_->listen_fd_ = -1;
94 } 94 }
95 STLDeleteElements(connection_->output_list()); 95 STLDeleteElements(connection_->output_list());
96 } 96 }
97 97
98 bool HasStream(uint32_t stream_id) { 98 bool HasStream(uint32_t stream_id) {
99 return interface_->output_ordering().ExistsInPriorityMaps(stream_id); 99 return interface_->output_ordering().ExistsInPriorityMaps(stream_id);
100 } 100 }
101 101
102 protected: 102 protected:
103 scoped_ptr<MockSMInterface> mock_another_interface_; 103 std::unique_ptr<MockSMInterface> mock_another_interface_;
104 scoped_ptr<MemoryCache> memory_cache_; 104 std::unique_ptr<MemoryCache> memory_cache_;
105 scoped_ptr<FlipAcceptor> acceptor_; 105 std::unique_ptr<FlipAcceptor> acceptor_;
106 scoped_ptr<EpollServer> epoll_server_; 106 std::unique_ptr<EpollServer> epoll_server_;
107 scoped_ptr<MockSMConnection> connection_; 107 std::unique_ptr<MockSMConnection> connection_;
108 scoped_ptr<HttpSM> interface_; 108 std::unique_ptr<HttpSM> interface_;
109 }; 109 };
110 110
111 class FlipHttpSMProxyTest : public FlipHttpSMTest { 111 class FlipHttpSMProxyTest : public FlipHttpSMTest {
112 public: 112 public:
113 FlipHttpSMProxyTest() : FlipHttpSMTest(FLIP_HANDLER_PROXY) {} 113 FlipHttpSMProxyTest() : FlipHttpSMTest(FLIP_HANDLER_PROXY) {}
114 ~FlipHttpSMProxyTest() override {} 114 ~FlipHttpSMProxyTest() override {}
115 }; 115 };
116 116
117 class FlipHttpSMHttpTest : public FlipHttpSMTest { 117 class FlipHttpSMHttpTest : public FlipHttpSMTest {
118 public: 118 public:
(...skipping 21 matching lines...) Expand all
140 std::string filename = "foobar"; 140 std::string filename = "foobar";
141 memory_cache_->InsertFile(&headers, filename, ""); 141 memory_cache_->InsertFile(&headers, filename, "");
142 mci.file_data = memory_cache_->GetFileData(filename); 142 mci.file_data = memory_cache_->GetFileData(filename);
143 } 143 }
144 144
145 interface_->AddToOutputOrder(mci); 145 interface_->AddToOutputOrder(mci);
146 ASSERT_TRUE(HasStream(stream_id)); 146 ASSERT_TRUE(HasStream(stream_id));
147 } 147 }
148 148
149 TEST_F(FlipHttpSMTest, InitSMInterface) { 149 TEST_F(FlipHttpSMTest, InitSMInterface) {
150 scoped_ptr<MockSMInterface> mock(new MockSMInterface); 150 std::unique_ptr<MockSMInterface> mock(new MockSMInterface);
151 { 151 {
152 InSequence s; 152 InSequence s;
153 EXPECT_CALL(*mock_another_interface_, SendEOF(_)); 153 EXPECT_CALL(*mock_another_interface_, SendEOF(_));
154 EXPECT_CALL(*mock_another_interface_, ResetForNewInterface(_)); 154 EXPECT_CALL(*mock_another_interface_, ResetForNewInterface(_));
155 EXPECT_CALL(*mock, SendEOF(_)); 155 EXPECT_CALL(*mock, SendEOF(_));
156 EXPECT_CALL(*mock, ResetForNewInterface(_)); 156 EXPECT_CALL(*mock, ResetForNewInterface(_));
157 } 157 }
158 158
159 interface_->ResetForNewConnection(); 159 interface_->ResetForNewConnection();
160 interface_->InitSMInterface(mock.get(), 0); 160 interface_->InitSMInterface(mock.get(), 0);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 } 482 }
483 interface_->SendEOF(32); 483 interface_->SendEOF(32);
484 ASSERT_EQ(1u, connection_->output_list()->size()); 484 ASSERT_EQ(1u, connection_->output_list()->size());
485 DataFrame* df = connection_->output_list()->front(); 485 DataFrame* df = connection_->output_list()->front();
486 ASSERT_EQ("0\r\n\r\n", StringPiece(df->data, df->size)); 486 ASSERT_EQ("0\r\n\r\n", StringPiece(df->data, df->size));
487 } 487 }
488 488
489 } // namespace 489 } // namespace
490 490
491 } // namespace net 491 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/flip_server/http_interface.h ('k') | net/tools/flip_server/mem_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698