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

Side by Side Diff: net/filter/filter_unittest.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/filter/filter.cc ('k') | net/filter/gzip_filter.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/filter/filter.h" 5 #include "net/filter/filter.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 encoding_types.clear(); 142 encoding_types.clear();
143 encoding_types.push_back(Filter::FILTER_TYPE_GZIP); 143 encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
144 Filter::FixupEncodingTypes(filter_context, &encoding_types); 144 Filter::FixupEncodingTypes(filter_context, &encoding_types);
145 ASSERT_EQ(1U, encoding_types.size()); 145 ASSERT_EQ(1U, encoding_types.size());
146 EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front()); 146 EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
147 } 147 }
148 148
149 // Make sure a series of three pass-through filters copies the data cleanly. 149 // Make sure a series of three pass-through filters copies the data cleanly.
150 // Regression test for http://crbug.com/418975. 150 // Regression test for http://crbug.com/418975.
151 TEST(FilterTest, ThreeFilterChain) { 151 TEST(FilterTest, ThreeFilterChain) {
152 scoped_ptr<PassThroughFilter> filter1(new PassThroughFilter); 152 std::unique_ptr<PassThroughFilter> filter1(new PassThroughFilter);
153 scoped_ptr<PassThroughFilter> filter2(new PassThroughFilter); 153 std::unique_ptr<PassThroughFilter> filter2(new PassThroughFilter);
154 scoped_ptr<PassThroughFilter> filter3(new PassThroughFilter); 154 std::unique_ptr<PassThroughFilter> filter3(new PassThroughFilter);
155 155
156 filter1->InitBuffer(32 * 1024); 156 filter1->InitBuffer(32 * 1024);
157 filter2->InitBuffer(32 * 1024); 157 filter2->InitBuffer(32 * 1024);
158 filter3->InitBuffer(32 * 1024); 158 filter3->InitBuffer(32 * 1024);
159 159
160 filter2->next_filter_ = std::move(filter3); 160 filter2->next_filter_ = std::move(filter3);
161 filter1->next_filter_ = std::move(filter2); 161 filter1->next_filter_ = std::move(filter2);
162 162
163 // Initialize the input array with a varying byte sequence. 163 // Initialize the input array with a varying byte sequence.
164 const size_t input_array_size = 64 * 1024; 164 const size_t input_array_size = 64 * 1024;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 amount_to_copy); 204 amount_to_copy);
205 filter1->FlushStreamBuffer(amount_to_copy); 205 filter1->FlushStreamBuffer(amount_to_copy);
206 read_array_index += amount_to_copy; 206 read_array_index += amount_to_copy;
207 } while (true); 207 } while (true);
208 208
209 EXPECT_EQ(read_array_index, input_array_size); 209 EXPECT_EQ(read_array_index, input_array_size);
210 EXPECT_EQ(compare_array_index, input_array_size); 210 EXPECT_EQ(compare_array_index, input_array_size);
211 } 211 }
212 212
213 } // Namespace net 213 } // Namespace net
OLDNEW
« no previous file with comments | « net/filter/filter.cc ('k') | net/filter/gzip_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698