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

Side by Side Diff: net/filter/gzip_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/gzip_filter.h ('k') | net/filter/mock_filter_context.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/gzip_filter.h"
6
5 #include <fstream> 7 #include <fstream>
8 #include <memory>
6 #include <ostream> 9 #include <ostream>
7 10
8 #include "base/bit_cast.h" 11 #include "base/bit_cast.h"
9 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/path_service.h" 13 #include "base/path_service.h"
12 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
13 #include "net/filter/gzip_filter.h"
14 #include "net/filter/mock_filter_context.h" 15 #include "net/filter/mock_filter_context.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "testing/platform_test.h" 17 #include "testing/platform_test.h"
17 #include "third_party/zlib/zlib.h" 18 #include "third_party/zlib/zlib.h"
18 19
19 namespace { 20 namespace {
20 21
21 const int kDefaultBufferSize = 4096; 22 const int kDefaultBufferSize = 4096;
22 const int kSmallBufferSize = 128; 23 const int kSmallBufferSize = 128;
23 24
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 std::vector<Filter::FilterType> filter_types; 227 std::vector<Filter::FilterType> filter_types;
227 filter_types.push_back(type); 228 filter_types.push_back(type);
228 filter_.reset(Filter::FactoryForTests(filter_types, filter_context_, 229 filter_.reset(Filter::FactoryForTests(filter_types, filter_context_,
229 buffer_size)); 230 buffer_size));
230 ASSERT_TRUE(filter_.get()); 231 ASSERT_TRUE(filter_.get());
231 } 232 }
232 233
233 const char* source_buffer() const { return source_buffer_.data(); } 234 const char* source_buffer() const { return source_buffer_.data(); }
234 int source_len() const { return static_cast<int>(source_buffer_.size()); } 235 int source_len() const { return static_cast<int>(source_buffer_.size()); }
235 236
236 scoped_ptr<Filter> filter_; 237 std::unique_ptr<Filter> filter_;
237 238
238 std::string source_buffer_; 239 std::string source_buffer_;
239 240
240 char* deflate_encode_buffer_; 241 char* deflate_encode_buffer_;
241 int deflate_encode_len_; 242 int deflate_encode_len_;
242 243
243 char* gzip_encode_buffer_; 244 char* gzip_encode_buffer_;
244 int gzip_encode_len_; 245 int gzip_encode_len_;
245 246
246 private: 247 private:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 int corrupt_decode_size = kDefaultBufferSize; 380 int corrupt_decode_size = kDefaultBufferSize;
380 381
381 int code = DecodeAllWithFilter(filter_.get(), corrupt_data, corrupt_data_len, 382 int code = DecodeAllWithFilter(filter_.get(), corrupt_data, corrupt_data_len,
382 corrupt_decode_buffer, &corrupt_decode_size); 383 corrupt_decode_buffer, &corrupt_decode_size);
383 384
384 // Expect failures 385 // Expect failures
385 EXPECT_TRUE(code == Filter::FILTER_ERROR); 386 EXPECT_TRUE(code == Filter::FILTER_ERROR);
386 } 387 }
387 388
388 } // namespace net 389 } // namespace net
OLDNEW
« no previous file with comments | « net/filter/gzip_filter.h ('k') | net/filter/mock_filter_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698