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

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

Issue 4096: Use open-vcdiff for sdch compression on the Mac (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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
« no previous file with comments | « net/base/filter.cc ('k') | net/base/test_completion_callback_unittest.cc » ('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 (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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 14 matching lines...) Expand all
25 const char kCompressedTestData[] = 25 const char kCompressedTestData[] =
26 "\326\303\304\0\0\001M\0\022I\0\t\003\001TestData \n\023\100\r"; 26 "\326\303\304\0\0\001M\0\022I\0\t\003\001TestData \n\023\100\r";
27 27
28 namespace { 28 namespace {
29 29
30 class SdchFilterTest : public testing::Test { 30 class SdchFilterTest : public testing::Test {
31 protected: 31 protected:
32 SdchFilterTest() 32 SdchFilterTest()
33 : test_vcdiff_dictionary_(kTtestVcdiffDictionary, 33 : test_vcdiff_dictionary_(kTtestVcdiffDictionary,
34 sizeof(kTtestVcdiffDictionary) - 1), 34 sizeof(kTtestVcdiffDictionary) - 1),
35 expanded_(kTestData, sizeof(kTestData) - 1),
36 compressed_test_data_(kCompressedTestData, 35 compressed_test_data_(kCompressedTestData,
37 sizeof(kCompressedTestData) - 1), 36 sizeof(kCompressedTestData) - 1),
37 expanded_(kTestData, sizeof(kTestData) - 1),
38 sdch_manager_(new SdchManager) { 38 sdch_manager_(new SdchManager) {
39 } 39 }
40 40
41 const std::string test_vcdiff_dictionary_; 41 const std::string test_vcdiff_dictionary_;
42 const std::string compressed_test_data_; 42 const std::string compressed_test_data_;
43 const std::string expanded_; // Desired final, decompressed data. 43 const std::string expanded_; // Desired final, decompressed data.
44 44
45 scoped_ptr<SdchManager> sdch_manager_; // A singleton database. 45 scoped_ptr<SdchManager> sdch_manager_; // A singleton database.
46 }; 46 };
47 47
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 //------------------------------------------------------------------------------ 97 //------------------------------------------------------------------------------
98 98
99 99
100 TEST_F(SdchFilterTest, BasicBadDicitonary) { 100 TEST_F(SdchFilterTest, BasicBadDicitonary) {
101 SdchManager::enable_sdch_support(""); 101 SdchManager::enable_sdch_support("");
102 102
103 std::vector<std::string> filters; 103 std::vector<std::string> filters;
104 filters.push_back("sdch"); 104 filters.push_back("sdch");
105 int kInputBufferSize(30); 105 int kInputBufferSize(30);
106 char output_buffer[20]; 106 char output_buffer[20];
107 size_t kOutputBufferSize(20);
108 scoped_ptr<Filter> filter(Filter::Factory(filters, "missing-mime", 107 scoped_ptr<Filter> filter(Filter::Factory(filters, "missing-mime",
109 kInputBufferSize)); 108 kInputBufferSize));
110 filter->SetURL(GURL("http://ignore.com")); 109 filter->SetURL(GURL("http://ignore.com"));
111 110
112 111
113 // With no input data, try to read output. 112 // With no input data, try to read output.
114 int output_bytes_or_buffer_size = sizeof(output_buffer); 113 int output_bytes_or_buffer_size = sizeof(output_buffer);
115 Filter::FilterStatus status = filter->ReadData(output_buffer, 114 Filter::FilterStatus status = filter->ReadData(output_buffer,
116 &output_bytes_or_buffer_size); 115 &output_bytes_or_buffer_size);
117 116
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 output.clear(); 441 output.clear();
443 status = FilterTestData(compressed, feed_block_size, output_block_size, 442 status = FilterTestData(compressed, feed_block_size, output_block_size,
444 filter.get(), &output); 443 filter.get(), &output);
445 EXPECT_TRUE(status); 444 EXPECT_TRUE(status);
446 EXPECT_TRUE(output == expanded_); 445 EXPECT_TRUE(output == expanded_);
447 446
448 MOZ_Z_deflateEnd(&zlib_stream); 447 MOZ_Z_deflateEnd(&zlib_stream);
449 } 448 }
450 449
451 }; // namespace anonymous 450 }; // namespace anonymous
OLDNEW
« no previous file with comments | « net/base/filter.cc ('k') | net/base/test_completion_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698