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

Side by Side Diff: net/base/gzip_filter_unittest.cc

Issue 6639002: Put Filter into namespace net. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responded to comments from tfarina Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2011 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 <fstream> 5 #include <fstream>
6 #include <iostream> 6 #include <iostream>
7 7
8 #if defined(USE_SYSTEM_ZLIB) 8 #if defined(USE_SYSTEM_ZLIB)
9 #include <zlib.h> 9 #include <zlib.h>
10 #else 10 #else
11 #include "third_party/zlib/zlib.h" 11 #include "third_party/zlib/zlib.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const char kGZipHeader[] = { '\037', '\213', '\010', '\000', '\000', 46 const char kGZipHeader[] = { '\037', '\213', '\010', '\000', '\000',
47 '\000', '\000', '\000', '\002', '\377' }; 47 '\000', '\000', '\000', '\002', '\377' };
48 48
49 enum EncodeMode { 49 enum EncodeMode {
50 ENCODE_GZIP, // Wrap the deflate with a GZip header. 50 ENCODE_GZIP, // Wrap the deflate with a GZip header.
51 ENCODE_DEFLATE // Raw deflate. 51 ENCODE_DEFLATE // Raw deflate.
52 }; 52 };
53 53
54 } // namespace 54 } // namespace
55 55
56 namespace net {
57
56 // These tests use the path service, which uses autoreleased objects on the 58 // These tests use the path service, which uses autoreleased objects on the
57 // Mac, so this needs to be a PlatformTest. 59 // Mac, so this needs to be a PlatformTest.
58 class GZipUnitTest : public PlatformTest { 60 class GZipUnitTest : public PlatformTest {
59 protected: 61 protected:
60 virtual void SetUp() { 62 virtual void SetUp() {
61 PlatformTest::SetUp(); 63 PlatformTest::SetUp();
62 64
63 deflate_encode_buffer_ = NULL; 65 deflate_encode_buffer_ = NULL;
64 gzip_encode_buffer_ = NULL; 66 gzip_encode_buffer_ = NULL;
65 67
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 InitFilter(Filter::FILTER_TYPE_GZIP); 386 InitFilter(Filter::FILTER_TYPE_GZIP);
385 char corrupt_decode_buffer[kDefaultBufferSize]; 387 char corrupt_decode_buffer[kDefaultBufferSize];
386 int corrupt_decode_size = kDefaultBufferSize; 388 int corrupt_decode_size = kDefaultBufferSize;
387 389
388 int code = DecodeAllWithFilter(filter_.get(), corrupt_data, corrupt_data_len, 390 int code = DecodeAllWithFilter(filter_.get(), corrupt_data, corrupt_data_len,
389 corrupt_decode_buffer, &corrupt_decode_size); 391 corrupt_decode_buffer, &corrupt_decode_size);
390 392
391 // Expect failures 393 // Expect failures
392 EXPECT_TRUE(code == Filter::FILTER_ERROR); 394 EXPECT_TRUE(code == Filter::FILTER_ERROR);
393 } 395 }
396
397 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698