OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <ostream> | 6 #include <ostream> |
7 | 7 |
8 #if defined(USE_SYSTEM_ZLIB) | |
9 #include <zlib.h> | |
10 #else | |
11 #include "third_party/zlib/zlib.h" | |
12 #endif | |
13 | |
14 #include "base/file_util.h" | 8 #include "base/file_util.h" |
15 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
16 #include "base/path_service.h" | 10 #include "base/path_service.h" |
17 #include "net/base/gzip_filter.h" | 11 #include "net/base/gzip_filter.h" |
18 #include "net/base/mock_filter_context.h" | 12 #include "net/base/mock_filter_context.h" |
19 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
| 16 #include "third_party/zlib/zlib.h" |
22 | 17 |
23 namespace { | 18 namespace { |
24 | 19 |
25 const int kDefaultBufferSize = 4096; | 20 const int kDefaultBufferSize = 4096; |
26 const int kSmallBufferSize = 128; | 21 const int kSmallBufferSize = 128; |
27 | 22 |
28 const char kApplicationOctetStream[] = "application/octet-stream"; | 23 const char kApplicationOctetStream[] = "application/octet-stream"; |
29 const char kApplicationXGzip[] = "application/x-gzip"; | 24 const char kApplicationXGzip[] = "application/x-gzip"; |
30 const char kApplicationGzip[] = "application/gzip"; | 25 const char kApplicationGzip[] = "application/gzip"; |
31 const char kApplicationXGunzip[] = "application/x-gunzip"; | 26 const char kApplicationXGunzip[] = "application/x-gunzip"; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 int corrupt_decode_size = kDefaultBufferSize; | 383 int corrupt_decode_size = kDefaultBufferSize; |
389 | 384 |
390 int code = DecodeAllWithFilter(filter_.get(), corrupt_data, corrupt_data_len, | 385 int code = DecodeAllWithFilter(filter_.get(), corrupt_data, corrupt_data_len, |
391 corrupt_decode_buffer, &corrupt_decode_size); | 386 corrupt_decode_buffer, &corrupt_decode_size); |
392 | 387 |
393 // Expect failures | 388 // Expect failures |
394 EXPECT_TRUE(code == Filter::FILTER_ERROR); | 389 EXPECT_TRUE(code == Filter::FILTER_ERROR); |
395 } | 390 } |
396 | 391 |
397 } // namespace net | 392 } // namespace net |
OLD | NEW |