OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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" |
12 #endif | 12 #endif |
13 | 13 |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
17 #include "net/base/gzip_filter.h" | 17 #include "net/base/gzip_filter.h" |
18 #include "net/base/mock_filter_context.h" | 18 #include "net/base/mock_filter_context.h" |
19 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "testing/platform_test.h" | 21 #include "testing/platform_test.h" |
22 | 22 |
23 namespace net { | |
tfarina
2011/03/08 20:54:49
please, could you move this to the line 56?
adamk
2011/03/08 21:35:20
Done.
| |
23 namespace { | 24 namespace { |
24 | 25 |
25 const int kDefaultBufferSize = 4096; | 26 const int kDefaultBufferSize = 4096; |
26 const int kSmallBufferSize = 128; | 27 const int kSmallBufferSize = 128; |
27 | 28 |
28 const char kApplicationOctetStream[] = "application/octet-stream"; | 29 const char kApplicationOctetStream[] = "application/octet-stream"; |
29 const char kApplicationXGzip[] = "application/x-gzip"; | 30 const char kApplicationXGzip[] = "application/x-gzip"; |
30 const char kApplicationGzip[] = "application/gzip"; | 31 const char kApplicationGzip[] = "application/gzip"; |
31 const char kApplicationXGunzip[] = "application/x-gunzip"; | 32 const char kApplicationXGunzip[] = "application/x-gunzip"; |
32 | 33 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 InitFilter(Filter::FILTER_TYPE_GZIP); | 385 InitFilter(Filter::FILTER_TYPE_GZIP); |
385 char corrupt_decode_buffer[kDefaultBufferSize]; | 386 char corrupt_decode_buffer[kDefaultBufferSize]; |
386 int corrupt_decode_size = kDefaultBufferSize; | 387 int corrupt_decode_size = kDefaultBufferSize; |
387 | 388 |
388 int code = DecodeAllWithFilter(filter_.get(), corrupt_data, corrupt_data_len, | 389 int code = DecodeAllWithFilter(filter_.get(), corrupt_data, corrupt_data_len, |
389 corrupt_decode_buffer, &corrupt_decode_size); | 390 corrupt_decode_buffer, &corrupt_decode_size); |
390 | 391 |
391 // Expect failures | 392 // Expect failures |
392 EXPECT_TRUE(code == Filter::FILTER_ERROR); | 393 EXPECT_TRUE(code == Filter::FILTER_ERROR); |
393 } | 394 } |
395 | |
396 } // namespace net | |
OLD | NEW |