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

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

Issue 6347033: net: Add namespace net to Sdch* classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: namespace on unittest Created 9 years, 10 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) 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 <limits.h> 5 #include <limits.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #if defined(USE_SYSTEM_ZLIB) 11 #if defined(USE_SYSTEM_ZLIB)
12 #include <zlib.h> 12 #include <zlib.h>
13 #else 13 #else
14 #include "third_party/zlib/zlib.h" 14 #include "third_party/zlib/zlib.h"
15 #endif 15 #endif
16 16
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/scoped_ptr.h" 18 #include "base/scoped_ptr.h"
19 #include "net/base/filter.h" 19 #include "net/base/filter.h"
20 #include "net/base/io_buffer.h" 20 #include "net/base/io_buffer.h"
21 #include "net/base/mock_filter_context.h" 21 #include "net/base/mock_filter_context.h"
22 #include "net/base/sdch_filter.h" 22 #include "net/base/sdch_filter.h"
23 #include "net/url_request/url_request_http_job.h" 23 #include "net/url_request/url_request_http_job.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 25
26 namespace net {
27
26 //------------------------------------------------------------------------------ 28 //------------------------------------------------------------------------------
27 // Provide sample data and compression results with a sample VCDIFF dictionary. 29 // Provide sample data and compression results with a sample VCDIFF dictionary.
28 // Note an SDCH dictionary has extra meta-data before the VCDIFF dictionary. 30 // Note an SDCH dictionary has extra meta-data before the VCDIFF dictionary.
29 static const char kTestVcdiffDictionary[] = "DictionaryFor" 31 static const char kTestVcdiffDictionary[] = "DictionaryFor"
30 "SdchCompression1SdchCompression2SdchCompression3SdchCompression\n"; 32 "SdchCompression1SdchCompression2SdchCompression3SdchCompression\n";
31 // Pre-compression test data. Note that we pad with a lot of highly gzip 33 // Pre-compression test data. Note that we pad with a lot of highly gzip
32 // compressible content to help to exercise the chaining pipeline. That is why 34 // compressible content to help to exercise the chaining pipeline. That is why
33 // there are a PILE of zeros at the start and end. 35 // there are a PILE of zeros at the start and end.
34 // This will ensure that gzip compressed data can be fed to the chain in one 36 // This will ensure that gzip compressed data can be fed to the chain in one
35 // gulp, but (with careful selection of intermediate buffers) that it takes 37 // gulp, but (with careful selection of intermediate buffers) that it takes
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return dictionary; 153 return dictionary;
152 } 154 }
153 155
154 //------------------------------------------------------------------------------ 156 //------------------------------------------------------------------------------
155 157
156 TEST_F(SdchFilterTest, EmptyInputOk) { 158 TEST_F(SdchFilterTest, EmptyInputOk) {
157 std::vector<Filter::FilterType> filter_types; 159 std::vector<Filter::FilterType> filter_types;
158 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 160 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
159 const int kInputBufferSize(30); 161 const int kInputBufferSize(30);
160 char output_buffer[20]; 162 char output_buffer[20];
161 net::MockFilterContext filter_context(kInputBufferSize); 163 MockFilterContext filter_context(kInputBufferSize);
162 std::string url_string("http://ignore.com"); 164 std::string url_string("http://ignore.com");
163 filter_context.SetURL(GURL(url_string)); 165 filter_context.SetURL(GURL(url_string));
164 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 166 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
165 167
166 168
167 // With no input data, try to read output. 169 // With no input data, try to read output.
168 int output_bytes_or_buffer_size = sizeof(output_buffer); 170 int output_bytes_or_buffer_size = sizeof(output_buffer);
169 Filter::FilterStatus status = filter->ReadData(output_buffer, 171 Filter::FilterStatus status = filter->ReadData(output_buffer,
170 &output_bytes_or_buffer_size); 172 &output_bytes_or_buffer_size);
171 173
172 EXPECT_EQ(0, output_bytes_or_buffer_size); 174 EXPECT_EQ(0, output_bytes_or_buffer_size);
173 EXPECT_EQ(Filter::FILTER_NEED_MORE_DATA, status); 175 EXPECT_EQ(Filter::FILTER_NEED_MORE_DATA, status);
174 } 176 }
175 177
176 TEST_F(SdchFilterTest, PassThroughWhenTentative) { 178 TEST_F(SdchFilterTest, PassThroughWhenTentative) {
177 std::vector<Filter::FilterType> filter_types; 179 std::vector<Filter::FilterType> filter_types;
178 // Selective a tentative filter (which can fall back to pass through). 180 // Selective a tentative filter (which can fall back to pass through).
179 filter_types.push_back(Filter::FILTER_TYPE_GZIP_HELPING_SDCH); 181 filter_types.push_back(Filter::FILTER_TYPE_GZIP_HELPING_SDCH);
180 const int kInputBufferSize(30); 182 const int kInputBufferSize(30);
181 char output_buffer[20]; 183 char output_buffer[20];
182 net::MockFilterContext filter_context(kInputBufferSize); 184 MockFilterContext filter_context(kInputBufferSize);
183 // Response code needs to be 200 to allow a pass through. 185 // Response code needs to be 200 to allow a pass through.
184 filter_context.SetResponseCode(200); 186 filter_context.SetResponseCode(200);
185 std::string url_string("http://ignore.com"); 187 std::string url_string("http://ignore.com");
186 filter_context.SetURL(GURL(url_string)); 188 filter_context.SetURL(GURL(url_string));
187 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 189 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
188 190
189 // Supply enough data to force a pass-through mode.. 191 // Supply enough data to force a pass-through mode..
190 std::string non_gzip_content("not GZIPed data"); 192 std::string non_gzip_content("not GZIPed data");
191 193
192 char* input_buffer = filter->stream_buffer()->data(); 194 char* input_buffer = filter->stream_buffer()->data();
(...skipping 19 matching lines...) Expand all
212 EXPECT_TRUE(non_gzip_content == output_buffer); 214 EXPECT_TRUE(non_gzip_content == output_buffer);
213 EXPECT_EQ(Filter::FILTER_NEED_MORE_DATA, status); 215 EXPECT_EQ(Filter::FILTER_NEED_MORE_DATA, status);
214 } 216 }
215 217
216 TEST_F(SdchFilterTest, RefreshBadReturnCode) { 218 TEST_F(SdchFilterTest, RefreshBadReturnCode) {
217 std::vector<Filter::FilterType> filter_types; 219 std::vector<Filter::FilterType> filter_types;
218 // Selective a tentative filter (which can fall back to pass through). 220 // Selective a tentative filter (which can fall back to pass through).
219 filter_types.push_back(Filter::FILTER_TYPE_SDCH_POSSIBLE); 221 filter_types.push_back(Filter::FILTER_TYPE_SDCH_POSSIBLE);
220 const int kInputBufferSize(30); 222 const int kInputBufferSize(30);
221 char output_buffer[20]; 223 char output_buffer[20];
222 net::MockFilterContext filter_context(kInputBufferSize); 224 MockFilterContext filter_context(kInputBufferSize);
223 // Response code needs to be 200 to allow a pass through. 225 // Response code needs to be 200 to allow a pass through.
224 filter_context.SetResponseCode(403); 226 filter_context.SetResponseCode(403);
225 // Meta refresh will only appear for html content 227 // Meta refresh will only appear for html content
226 filter_context.SetMimeType("text/html"); 228 filter_context.SetMimeType("text/html");
227 std::string url_string("http://ignore.com"); 229 std::string url_string("http://ignore.com");
228 filter_context.SetURL(GURL(url_string)); 230 filter_context.SetURL(GURL(url_string));
229 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 231 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
230 232
231 // Supply enough data to force a pass-through mode, which means we have 233 // Supply enough data to force a pass-through mode, which means we have
232 // provided more than 9 characters that can't be a dictionary hash. 234 // provided more than 9 characters that can't be a dictionary hash.
(...skipping 22 matching lines...) Expand all
255 sizeof(output_buffer))); 257 sizeof(output_buffer)));
256 EXPECT_EQ(Filter::FILTER_OK, status); 258 EXPECT_EQ(Filter::FILTER_OK, status);
257 } 259 }
258 260
259 TEST_F(SdchFilterTest, ErrorOnBadReturnCode) { 261 TEST_F(SdchFilterTest, ErrorOnBadReturnCode) {
260 std::vector<Filter::FilterType> filter_types; 262 std::vector<Filter::FilterType> filter_types;
261 // Selective a tentative filter (which can fall back to pass through). 263 // Selective a tentative filter (which can fall back to pass through).
262 filter_types.push_back(Filter::FILTER_TYPE_SDCH_POSSIBLE); 264 filter_types.push_back(Filter::FILTER_TYPE_SDCH_POSSIBLE);
263 const int kInputBufferSize(30); 265 const int kInputBufferSize(30);
264 char output_buffer[20]; 266 char output_buffer[20];
265 net::MockFilterContext filter_context(kInputBufferSize); 267 MockFilterContext filter_context(kInputBufferSize);
266 // Response code needs to be 200 to allow a pass through. 268 // Response code needs to be 200 to allow a pass through.
267 filter_context.SetResponseCode(403); 269 filter_context.SetResponseCode(403);
268 // Meta refresh will only appear for html content, so set to something else 270 // Meta refresh will only appear for html content, so set to something else
269 // to induce an error (we can't meta refresh). 271 // to induce an error (we can't meta refresh).
270 filter_context.SetMimeType("anything"); 272 filter_context.SetMimeType("anything");
271 std::string url_string("http://ignore.com"); 273 std::string url_string("http://ignore.com");
272 filter_context.SetURL(GURL(url_string)); 274 filter_context.SetURL(GURL(url_string));
273 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 275 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
274 276
275 // Supply enough data to force a pass-through mode, which means we have 277 // Supply enough data to force a pass-through mode, which means we have
(...skipping 18 matching lines...) Expand all
294 EXPECT_EQ(0, output_bytes_or_buffer_size); 296 EXPECT_EQ(0, output_bytes_or_buffer_size);
295 EXPECT_EQ(Filter::FILTER_ERROR, status); 297 EXPECT_EQ(Filter::FILTER_ERROR, status);
296 } 298 }
297 299
298 TEST_F(SdchFilterTest, ErrorOnBadReturnCodeWithHtml) { 300 TEST_F(SdchFilterTest, ErrorOnBadReturnCodeWithHtml) {
299 std::vector<Filter::FilterType> filter_types; 301 std::vector<Filter::FilterType> filter_types;
300 // Selective a tentative filter (which can fall back to pass through). 302 // Selective a tentative filter (which can fall back to pass through).
301 filter_types.push_back(Filter::FILTER_TYPE_SDCH_POSSIBLE); 303 filter_types.push_back(Filter::FILTER_TYPE_SDCH_POSSIBLE);
302 const int kInputBufferSize(30); 304 const int kInputBufferSize(30);
303 char output_buffer[20]; 305 char output_buffer[20];
304 net::MockFilterContext filter_context(kInputBufferSize); 306 MockFilterContext filter_context(kInputBufferSize);
305 // Response code needs to be 200 to allow a pass through. 307 // Response code needs to be 200 to allow a pass through.
306 filter_context.SetResponseCode(403); 308 filter_context.SetResponseCode(403);
307 // Meta refresh will only appear for html content 309 // Meta refresh will only appear for html content
308 filter_context.SetMimeType("text/html"); 310 filter_context.SetMimeType("text/html");
309 std::string url_string("http://ignore.com"); 311 std::string url_string("http://ignore.com");
310 filter_context.SetURL(GURL(url_string)); 312 filter_context.SetURL(GURL(url_string));
311 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 313 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
312 314
313 // Supply enough data to force a pass-through mode, which means we have 315 // Supply enough data to force a pass-through mode, which means we have
314 // provided more than 9 characters that can't be a dictionary hash. 316 // provided more than 9 characters that can't be a dictionary hash.
(...skipping 22 matching lines...) Expand all
337 "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"0\"></head>", 339 "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"0\"></head>",
338 sizeof(output_buffer))); 340 sizeof(output_buffer)));
339 EXPECT_EQ(Filter::FILTER_OK, status); 341 EXPECT_EQ(Filter::FILTER_OK, status);
340 } 342 }
341 343
342 TEST_F(SdchFilterTest, BasicBadDictionary) { 344 TEST_F(SdchFilterTest, BasicBadDictionary) {
343 std::vector<Filter::FilterType> filter_types; 345 std::vector<Filter::FilterType> filter_types;
344 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 346 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
345 const int kInputBufferSize(30); 347 const int kInputBufferSize(30);
346 char output_buffer[20]; 348 char output_buffer[20];
347 net::MockFilterContext filter_context(kInputBufferSize); 349 MockFilterContext filter_context(kInputBufferSize);
348 std::string url_string("http://ignore.com"); 350 std::string url_string("http://ignore.com");
349 filter_context.SetURL(GURL(url_string)); 351 filter_context.SetURL(GURL(url_string));
350 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 352 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
351 353
352 // Supply bogus data (which doesn't yet specify a full dictionary hash). 354 // Supply bogus data (which doesn't yet specify a full dictionary hash).
353 // Dictionary hash is 8 characters followed by a null. 355 // Dictionary hash is 8 characters followed by a null.
354 std::string dictionary_hash_prefix("123"); 356 std::string dictionary_hash_prefix("123");
355 357
356 char* input_buffer = filter->stream_buffer()->data(); 358 char* input_buffer = filter->stream_buffer()->data();
357 int input_buffer_size = filter->stream_buffer_size(); 359 int input_buffer_size = filter->stream_buffer_size();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 GURL url(url_string); 427 GURL url(url_string);
426 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url)); 428 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
427 429
428 std::string compressed(NewSdchCompressedData(dictionary)); 430 std::string compressed(NewSdchCompressedData(dictionary));
429 431
430 std::vector<Filter::FilterType> filter_types; 432 std::vector<Filter::FilterType> filter_types;
431 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 433 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
432 434
433 // Decode with a large buffer (larger than test input, or compressed data). 435 // Decode with a large buffer (larger than test input, or compressed data).
434 const int kInputBufferSize(100); 436 const int kInputBufferSize(100);
435 net::MockFilterContext filter_context(kInputBufferSize); 437 MockFilterContext filter_context(kInputBufferSize);
436 filter_context.SetURL(url); 438 filter_context.SetURL(url);
437 439
438 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 440 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
439 441
440 size_t feed_block_size = 100; 442 size_t feed_block_size = 100;
441 size_t output_block_size = 100; 443 size_t output_block_size = 100;
442 std::string output; 444 std::string output;
443 EXPECT_TRUE(FilterTestData(compressed, feed_block_size, output_block_size, 445 EXPECT_TRUE(FilterTestData(compressed, feed_block_size, output_block_size,
444 filter.get(), &output)); 446 filter.get(), &output));
445 EXPECT_EQ(output, expanded_); 447 EXPECT_EQ(output, expanded_);
(...skipping 18 matching lines...) Expand all
464 466
465 GURL url(url_string); 467 GURL url(url_string);
466 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url)); 468 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
467 469
468 std::string compressed(NewSdchCompressedData(dictionary)); 470 std::string compressed(NewSdchCompressedData(dictionary));
469 471
470 std::vector<Filter::FilterType> filter_types; 472 std::vector<Filter::FilterType> filter_types;
471 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 473 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
472 474
473 const int kInputBufferSize(100); 475 const int kInputBufferSize(100);
474 net::MockFilterContext filter_context(kInputBufferSize); 476 MockFilterContext filter_context(kInputBufferSize);
475 filter_context.SetURL(GURL("https://" + kSampleDomain)); 477 filter_context.SetURL(GURL("https://" + kSampleDomain));
476 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 478 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
477 479
478 const size_t feed_block_size(100); 480 const size_t feed_block_size(100);
479 const size_t output_block_size(100); 481 const size_t output_block_size(100);
480 std::string output; 482 std::string output;
481 483
482 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size, 484 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size,
483 filter.get(), &output)); 485 filter.get(), &output));
484 } 486 }
(...skipping 11 matching lines...) Expand all
496 498
497 GURL url(url_string); 499 GURL url(url_string);
498 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url)); 500 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
499 501
500 std::string compressed(NewSdchCompressedData(dictionary)); 502 std::string compressed(NewSdchCompressedData(dictionary));
501 503
502 std::vector<Filter::FilterType> filter_types; 504 std::vector<Filter::FilterType> filter_types;
503 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 505 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
504 506
505 const int kInputBufferSize(100); 507 const int kInputBufferSize(100);
506 net::MockFilterContext filter_context(kInputBufferSize); 508 MockFilterContext filter_context(kInputBufferSize);
507 filter_context.SetURL(GURL("ftp://" + kSampleDomain)); 509 filter_context.SetURL(GURL("ftp://" + kSampleDomain));
508 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 510 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
509 511
510 const size_t feed_block_size(100); 512 const size_t feed_block_size(100);
511 const size_t output_block_size(100); 513 const size_t output_block_size(100);
512 std::string output; 514 std::string output;
513 515
514 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size, 516 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size,
515 filter.get(), &output)); 517 filter.get(), &output));
516 } 518 }
517 519
518 TEST_F(SdchFilterTest, NoDecodeFileColon) { 520 TEST_F(SdchFilterTest, NoDecodeFileColon) {
519 // Construct a valid SDCH dictionary from a VCDIFF dictionary. 521 // Construct a valid SDCH dictionary from a VCDIFF dictionary.
520 const std::string kSampleDomain = "sdchtest.com"; 522 const std::string kSampleDomain = "sdchtest.com";
521 std::string dictionary(NewSdchDictionary(kSampleDomain)); 523 std::string dictionary(NewSdchDictionary(kSampleDomain));
522 524
523 std::string url_string = "http://" + kSampleDomain; 525 std::string url_string = "http://" + kSampleDomain;
524 526
525 GURL url(url_string); 527 GURL url(url_string);
526 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url)); 528 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
527 529
528 std::string compressed(NewSdchCompressedData(dictionary)); 530 std::string compressed(NewSdchCompressedData(dictionary));
529 531
530 std::vector<Filter::FilterType> filter_types; 532 std::vector<Filter::FilterType> filter_types;
531 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 533 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
532 534
533 const int kInputBufferSize(100); 535 const int kInputBufferSize(100);
534 net::MockFilterContext filter_context(kInputBufferSize); 536 MockFilterContext filter_context(kInputBufferSize);
535 filter_context.SetURL(GURL("file://" + kSampleDomain)); 537 filter_context.SetURL(GURL("file://" + kSampleDomain));
536 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 538 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
537 539
538 const size_t feed_block_size(100); 540 const size_t feed_block_size(100);
539 const size_t output_block_size(100); 541 const size_t output_block_size(100);
540 std::string output; 542 std::string output;
541 543
542 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size, 544 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size,
543 filter.get(), &output)); 545 filter.get(), &output));
544 } 546 }
545 547
546 TEST_F(SdchFilterTest, NoDecodeAboutColon) { 548 TEST_F(SdchFilterTest, NoDecodeAboutColon) {
547 // Construct a valid SDCH dictionary from a VCDIFF dictionary. 549 // Construct a valid SDCH dictionary from a VCDIFF dictionary.
548 const std::string kSampleDomain = "sdchtest.com"; 550 const std::string kSampleDomain = "sdchtest.com";
549 std::string dictionary(NewSdchDictionary(kSampleDomain)); 551 std::string dictionary(NewSdchDictionary(kSampleDomain));
550 552
551 std::string url_string = "http://" + kSampleDomain; 553 std::string url_string = "http://" + kSampleDomain;
552 554
553 GURL url(url_string); 555 GURL url(url_string);
554 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url)); 556 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
555 557
556 std::string compressed(NewSdchCompressedData(dictionary)); 558 std::string compressed(NewSdchCompressedData(dictionary));
557 559
558 std::vector<Filter::FilterType> filter_types; 560 std::vector<Filter::FilterType> filter_types;
559 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 561 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
560 562
561 const int kInputBufferSize(100); 563 const int kInputBufferSize(100);
562 net::MockFilterContext filter_context(kInputBufferSize); 564 MockFilterContext filter_context(kInputBufferSize);
563 filter_context.SetURL(GURL("about://" + kSampleDomain)); 565 filter_context.SetURL(GURL("about://" + kSampleDomain));
564 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 566 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
565 567
566 const size_t feed_block_size(100); 568 const size_t feed_block_size(100);
567 const size_t output_block_size(100); 569 const size_t output_block_size(100);
568 std::string output; 570 std::string output;
569 571
570 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size, 572 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size,
571 filter.get(), &output)); 573 filter.get(), &output));
572 } 574 }
573 575
574 TEST_F(SdchFilterTest, NoDecodeJavaScript) { 576 TEST_F(SdchFilterTest, NoDecodeJavaScript) {
575 // Construct a valid SDCH dictionary from a VCDIFF dictionary. 577 // Construct a valid SDCH dictionary from a VCDIFF dictionary.
576 const std::string kSampleDomain = "sdchtest.com"; 578 const std::string kSampleDomain = "sdchtest.com";
577 std::string dictionary(NewSdchDictionary(kSampleDomain)); 579 std::string dictionary(NewSdchDictionary(kSampleDomain));
578 580
579 std::string url_string = "http://" + kSampleDomain; 581 std::string url_string = "http://" + kSampleDomain;
580 582
581 GURL url(url_string); 583 GURL url(url_string);
582 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url)); 584 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
583 585
584 std::string compressed(NewSdchCompressedData(dictionary)); 586 std::string compressed(NewSdchCompressedData(dictionary));
585 587
586 std::vector<Filter::FilterType> filter_types; 588 std::vector<Filter::FilterType> filter_types;
587 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 589 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
588 590
589 const int kInputBufferSize(100); 591 const int kInputBufferSize(100);
590 net::MockFilterContext filter_context(kInputBufferSize); 592 MockFilterContext filter_context(kInputBufferSize);
591 filter_context.SetURL(GURL("javascript://" + kSampleDomain)); 593 filter_context.SetURL(GURL("javascript://" + kSampleDomain));
592 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 594 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
593 595
594 const size_t feed_block_size(100); 596 const size_t feed_block_size(100);
595 const size_t output_block_size(100); 597 const size_t output_block_size(100);
596 std::string output; 598 std::string output;
597 599
598 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size, 600 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size,
599 filter.get(), &output)); 601 filter.get(), &output));
600 } 602 }
601 603
602 TEST_F(SdchFilterTest, CanStillDecodeHttp) { 604 TEST_F(SdchFilterTest, CanStillDecodeHttp) {
603 // Construct a valid SDCH dictionary from a VCDIFF dictionary. 605 // Construct a valid SDCH dictionary from a VCDIFF dictionary.
604 const std::string kSampleDomain = "sdchtest.com"; 606 const std::string kSampleDomain = "sdchtest.com";
605 std::string dictionary(NewSdchDictionary(kSampleDomain)); 607 std::string dictionary(NewSdchDictionary(kSampleDomain));
606 608
607 std::string url_string = "http://" + kSampleDomain; 609 std::string url_string = "http://" + kSampleDomain;
608 610
609 GURL url(url_string); 611 GURL url(url_string);
610 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url)); 612 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
611 613
612 std::string compressed(NewSdchCompressedData(dictionary)); 614 std::string compressed(NewSdchCompressedData(dictionary));
613 615
614 std::vector<Filter::FilterType> filter_types; 616 std::vector<Filter::FilterType> filter_types;
615 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 617 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
616 618
617 const int kInputBufferSize(100); 619 const int kInputBufferSize(100);
618 net::MockFilterContext filter_context(kInputBufferSize); 620 MockFilterContext filter_context(kInputBufferSize);
619 filter_context.SetURL(GURL("http://" + kSampleDomain)); 621 filter_context.SetURL(GURL("http://" + kSampleDomain));
620 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 622 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
621 623
622 const size_t feed_block_size(100); 624 const size_t feed_block_size(100);
623 const size_t output_block_size(100); 625 const size_t output_block_size(100);
624 std::string output; 626 std::string output;
625 627
626 EXPECT_TRUE(FilterTestData(compressed, feed_block_size, output_block_size, 628 EXPECT_TRUE(FilterTestData(compressed, feed_block_size, output_block_size,
627 filter.get(), &output)); 629 filter.get(), &output));
628 } 630 }
629 631
630 TEST_F(SdchFilterTest, CrossDomainDictionaryUse) { 632 TEST_F(SdchFilterTest, CrossDomainDictionaryUse) {
631 // Construct a valid SDCH dictionary from a VCDIFF dictionary. 633 // Construct a valid SDCH dictionary from a VCDIFF dictionary.
632 const std::string kSampleDomain = "sdchtest.com"; 634 const std::string kSampleDomain = "sdchtest.com";
633 std::string dictionary(NewSdchDictionary(kSampleDomain)); 635 std::string dictionary(NewSdchDictionary(kSampleDomain));
634 636
635 std::string url_string = "http://" + kSampleDomain; 637 std::string url_string = "http://" + kSampleDomain;
636 638
637 GURL url(url_string); 639 GURL url(url_string);
638 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url)); 640 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
639 641
640 std::string compressed(NewSdchCompressedData(dictionary)); 642 std::string compressed(NewSdchCompressedData(dictionary));
641 643
642 std::vector<Filter::FilterType> filter_types; 644 std::vector<Filter::FilterType> filter_types;
643 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 645 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
644 const int kInputBufferSize(100); 646 const int kInputBufferSize(100);
645 647
646 // Decode with content arriving from the "wrong" domain. 648 // Decode with content arriving from the "wrong" domain.
647 // This tests SdchManager::CanSet(). 649 // This tests SdchManager::CanSet().
648 net::MockFilterContext filter_context(kInputBufferSize); 650 MockFilterContext filter_context(kInputBufferSize);
649 GURL wrong_domain_url("http://www.wrongdomain.com"); 651 GURL wrong_domain_url("http://www.wrongdomain.com");
650 filter_context.SetURL(wrong_domain_url); 652 filter_context.SetURL(wrong_domain_url);
651 scoped_ptr<Filter> filter((Filter::Factory(filter_types, filter_context))); 653 scoped_ptr<Filter> filter((Filter::Factory(filter_types, filter_context)));
652 654
653 size_t feed_block_size = 100; 655 size_t feed_block_size = 100;
654 size_t output_block_size = 100; 656 size_t output_block_size = 100;
655 std::string output; 657 std::string output;
656 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size, 658 EXPECT_FALSE(FilterTestData(compressed, feed_block_size, output_block_size,
657 filter.get(), &output)); 659 filter.get(), &output));
658 EXPECT_EQ(output.size(), 0u); // No output written. 660 EXPECT_EQ(output.size(), 0u); // No output written.
(...skipping 20 matching lines...) Expand all
679 dictionary_with_path.append(dictionary); 681 dictionary_with_path.append(dictionary);
680 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_with_path, url)); 682 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_with_path, url));
681 683
682 std::string compressed_for_path(NewSdchCompressedData(dictionary_with_path)); 684 std::string compressed_for_path(NewSdchCompressedData(dictionary_with_path));
683 685
684 std::vector<Filter::FilterType> filter_types; 686 std::vector<Filter::FilterType> filter_types;
685 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 687 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
686 const int kInputBufferSize(100); 688 const int kInputBufferSize(100);
687 689
688 // Test decode the path data, arriving from a valid path. 690 // Test decode the path data, arriving from a valid path.
689 net::MockFilterContext filter_context(kInputBufferSize); 691 MockFilterContext filter_context(kInputBufferSize);
690 filter_context.SetURL(GURL(url_string + path)); 692 filter_context.SetURL(GURL(url_string + path));
691 scoped_ptr<Filter> filter((Filter::Factory(filter_types, filter_context))); 693 scoped_ptr<Filter> filter((Filter::Factory(filter_types, filter_context)));
692 694
693 size_t feed_block_size = 100; 695 size_t feed_block_size = 100;
694 size_t output_block_size = 100; 696 size_t output_block_size = 100;
695 std::string output; 697 std::string output;
696 698
697 EXPECT_TRUE(FilterTestData(compressed_for_path, feed_block_size, 699 EXPECT_TRUE(FilterTestData(compressed_for_path, feed_block_size,
698 output_block_size, filter.get(), &output)); 700 output_block_size, filter.get(), &output));
699 EXPECT_EQ(output, expanded_); 701 EXPECT_EQ(output, expanded_);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_with_port, 735 EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_with_port,
734 GURL(url_string + ":" + port))); 736 GURL(url_string + ":" + port)));
735 737
736 std::string compressed_for_port(NewSdchCompressedData(dictionary_with_port)); 738 std::string compressed_for_port(NewSdchCompressedData(dictionary_with_port));
737 739
738 std::vector<Filter::FilterType> filter_types; 740 std::vector<Filter::FilterType> filter_types;
739 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 741 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
740 const int kInputBufferSize(100); 742 const int kInputBufferSize(100);
741 743
742 // Test decode the port data, arriving from a valid port. 744 // Test decode the port data, arriving from a valid port.
743 net::MockFilterContext filter_context(kInputBufferSize); 745 MockFilterContext filter_context(kInputBufferSize);
744 filter_context.SetURL(GURL(url_string + ":" + port)); 746 filter_context.SetURL(GURL(url_string + ":" + port));
745 scoped_ptr<Filter> filter((Filter::Factory(filter_types, filter_context))); 747 scoped_ptr<Filter> filter((Filter::Factory(filter_types, filter_context)));
746 748
747 size_t feed_block_size = 100; 749 size_t feed_block_size = 100;
748 size_t output_block_size = 100; 750 size_t output_block_size = 100;
749 std::string output; 751 std::string output;
750 EXPECT_TRUE(FilterTestData(compressed_for_port, feed_block_size, 752 EXPECT_TRUE(FilterTestData(compressed_for_port, feed_block_size,
751 output_block_size, filter.get(), &output)); 753 output_block_size, filter.get(), &output));
752 EXPECT_EQ(output, expanded_); 754 EXPECT_EQ(output, expanded_);
753 755
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 // Construct a chained filter. 858 // Construct a chained filter.
857 std::vector<Filter::FilterType> filter_types; 859 std::vector<Filter::FilterType> filter_types;
858 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 860 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
859 filter_types.push_back(Filter::FILTER_TYPE_GZIP); 861 filter_types.push_back(Filter::FILTER_TYPE_GZIP);
860 862
861 // First try with a large buffer (larger than test input, or compressed data). 863 // First try with a large buffer (larger than test input, or compressed data).
862 const size_t kLargeInputBufferSize(1000); // Used internally in filters. 864 const size_t kLargeInputBufferSize(1000); // Used internally in filters.
863 CHECK_GT(kLargeInputBufferSize, gzip_compressed_sdch.size()); 865 CHECK_GT(kLargeInputBufferSize, gzip_compressed_sdch.size());
864 CHECK_GT(kLargeInputBufferSize, sdch_compressed.size()); 866 CHECK_GT(kLargeInputBufferSize, sdch_compressed.size());
865 CHECK_GT(kLargeInputBufferSize, expanded_.size()); 867 CHECK_GT(kLargeInputBufferSize, expanded_.size());
866 net::MockFilterContext filter_context(kLargeInputBufferSize); 868 MockFilterContext filter_context(kLargeInputBufferSize);
867 filter_context.SetURL(url); 869 filter_context.SetURL(url);
868 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 870 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
869 871
870 // Verify that chained filter is waiting for data. 872 // Verify that chained filter is waiting for data.
871 char tiny_output_buffer[10]; 873 char tiny_output_buffer[10];
872 int tiny_output_size = sizeof(tiny_output_buffer); 874 int tiny_output_size = sizeof(tiny_output_buffer);
873 EXPECT_EQ(Filter::FILTER_NEED_MORE_DATA, 875 EXPECT_EQ(Filter::FILTER_NEED_MORE_DATA,
874 filter->ReadData(tiny_output_buffer, &tiny_output_size)); 876 filter->ReadData(tiny_output_buffer, &tiny_output_size));
875 877
876 // Make chain process all data. 878 // Make chain process all data.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 928
927 // Use Gzip to compress the sdch sdch_compressed data. 929 // Use Gzip to compress the sdch sdch_compressed data.
928 std::string gzip_compressed_sdch = gzip_compress(sdch_compressed); 930 std::string gzip_compressed_sdch = gzip_compress(sdch_compressed);
929 931
930 // Only claim to have sdch content, but really use the gzipped sdch content. 932 // Only claim to have sdch content, but really use the gzipped sdch content.
931 // System should automatically add the missing (optional) gzip. 933 // System should automatically add the missing (optional) gzip.
932 std::vector<Filter::FilterType> filter_types; 934 std::vector<Filter::FilterType> filter_types;
933 filter_types.push_back(Filter::FILTER_TYPE_SDCH); 935 filter_types.push_back(Filter::FILTER_TYPE_SDCH);
934 936
935 const int kInputBufferSize(100); 937 const int kInputBufferSize(100);
936 net::MockFilterContext filter_context(kInputBufferSize); 938 MockFilterContext filter_context(kInputBufferSize);
937 filter_context.SetMimeType("anything/mime"); 939 filter_context.SetMimeType("anything/mime");
938 filter_context.SetSdchResponse(true); 940 filter_context.SetSdchResponse(true);
939 Filter::FixupEncodingTypes(filter_context, &filter_types); 941 Filter::FixupEncodingTypes(filter_context, &filter_types);
940 ASSERT_EQ(filter_types.size(), 2u); 942 ASSERT_EQ(filter_types.size(), 2u);
941 EXPECT_EQ(filter_types[0], Filter::FILTER_TYPE_SDCH); 943 EXPECT_EQ(filter_types[0], Filter::FILTER_TYPE_SDCH);
942 EXPECT_EQ(filter_types[1], Filter::FILTER_TYPE_GZIP_HELPING_SDCH); 944 EXPECT_EQ(filter_types[1], Filter::FILTER_TYPE_GZIP_HELPING_SDCH);
943 945
944 // First try with a large buffer (larger than test input, or compressed data). 946 // First try with a large buffer (larger than test input, or compressed data).
945 filter_context.SetURL(url); 947 filter_context.SetURL(url);
946 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 948 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 std::string gzip_compressed_sdch = gzip_compress(sdch_compressed); 988 std::string gzip_compressed_sdch = gzip_compress(sdch_compressed);
987 989
988 // Some proxies strip the content encoding statement down to a mere gzip, but 990 // Some proxies strip the content encoding statement down to a mere gzip, but
989 // pass through the original content (with full sdch,gzip encoding). 991 // pass through the original content (with full sdch,gzip encoding).
990 // Only claim to have gzip content, but really use the gzipped sdch content. 992 // Only claim to have gzip content, but really use the gzipped sdch content.
991 // System should automatically add the missing (optional) sdch. 993 // System should automatically add the missing (optional) sdch.
992 std::vector<Filter::FilterType> filter_types; 994 std::vector<Filter::FilterType> filter_types;
993 filter_types.push_back(Filter::FILTER_TYPE_GZIP); 995 filter_types.push_back(Filter::FILTER_TYPE_GZIP);
994 996
995 const int kInputBufferSize(100); 997 const int kInputBufferSize(100);
996 net::MockFilterContext filter_context(kInputBufferSize); 998 MockFilterContext filter_context(kInputBufferSize);
997 filter_context.SetMimeType("anything/mime"); 999 filter_context.SetMimeType("anything/mime");
998 filter_context.SetSdchResponse(true); 1000 filter_context.SetSdchResponse(true);
999 Filter::FixupEncodingTypes(filter_context, &filter_types); 1001 Filter::FixupEncodingTypes(filter_context, &filter_types);
1000 ASSERT_EQ(filter_types.size(), 3u); 1002 ASSERT_EQ(filter_types.size(), 3u);
1001 EXPECT_EQ(filter_types[0], Filter::FILTER_TYPE_SDCH_POSSIBLE); 1003 EXPECT_EQ(filter_types[0], Filter::FILTER_TYPE_SDCH_POSSIBLE);
1002 EXPECT_EQ(filter_types[1], Filter::FILTER_TYPE_GZIP_HELPING_SDCH); 1004 EXPECT_EQ(filter_types[1], Filter::FILTER_TYPE_GZIP_HELPING_SDCH);
1003 EXPECT_EQ(filter_types[2], Filter::FILTER_TYPE_GZIP); 1005 EXPECT_EQ(filter_types[2], Filter::FILTER_TYPE_GZIP);
1004 1006
1005 // First try with a large buffer (larger than test input, or compressed data). 1007 // First try with a large buffer (larger than test input, or compressed data).
1006 filter_context.SetURL(url); 1008 filter_context.SetURL(url);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 1047
1046 // Use Gzip to compress the sdch sdch_compressed data. 1048 // Use Gzip to compress the sdch sdch_compressed data.
1047 std::string gzip_compressed_sdch = gzip_compress(sdch_compressed); 1049 std::string gzip_compressed_sdch = gzip_compress(sdch_compressed);
1048 1050
1049 // Only claim to have non-encoded content, but really use the gzipped sdch 1051 // Only claim to have non-encoded content, but really use the gzipped sdch
1050 // content. 1052 // content.
1051 // System should automatically add the missing (optional) sdch,gzip. 1053 // System should automatically add the missing (optional) sdch,gzip.
1052 std::vector<Filter::FilterType> filter_types; 1054 std::vector<Filter::FilterType> filter_types;
1053 1055
1054 const int kInputBufferSize(100); 1056 const int kInputBufferSize(100);
1055 net::MockFilterContext filter_context(kInputBufferSize); 1057 MockFilterContext filter_context(kInputBufferSize);
1056 filter_context.SetMimeType("anything/mime"); 1058 filter_context.SetMimeType("anything/mime");
1057 filter_context.SetSdchResponse(true); 1059 filter_context.SetSdchResponse(true);
1058 Filter::FixupEncodingTypes(filter_context, &filter_types); 1060 Filter::FixupEncodingTypes(filter_context, &filter_types);
1059 ASSERT_EQ(filter_types.size(), 2u); 1061 ASSERT_EQ(filter_types.size(), 2u);
1060 EXPECT_EQ(filter_types[0], Filter::FILTER_TYPE_SDCH_POSSIBLE); 1062 EXPECT_EQ(filter_types[0], Filter::FILTER_TYPE_SDCH_POSSIBLE);
1061 EXPECT_EQ(filter_types[1], Filter::FILTER_TYPE_GZIP_HELPING_SDCH); 1063 EXPECT_EQ(filter_types[1], Filter::FILTER_TYPE_GZIP_HELPING_SDCH);
1062 1064
1063 // First try with a large buffer (larger than test input, or compressed data). 1065 // First try with a large buffer (larger than test input, or compressed data).
1064 filter_context.SetURL(url); 1066 filter_context.SetURL(url);
1065 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); 1067 scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 std::string double_gzip_compressed_sdch = gzip_compress(gzip_compress( 1110 std::string double_gzip_compressed_sdch = gzip_compress(gzip_compress(
1109 sdch_compressed)); 1111 sdch_compressed));
1110 1112
1111 // Only claim to have gzip content, but really use the double gzipped sdch 1113 // Only claim to have gzip content, but really use the double gzipped sdch
1112 // content. 1114 // content.
1113 // System should automatically add the missing (optional) sdch, gzip decoders. 1115 // System should automatically add the missing (optional) sdch, gzip decoders.
1114 std::vector<Filter::FilterType> filter_types; 1116 std::vector<Filter::FilterType> filter_types;
1115 filter_types.push_back(Filter::FILTER_TYPE_GZIP); 1117 filter_types.push_back(Filter::FILTER_TYPE_GZIP);
1116 1118
1117 const int kInputBufferSize(100); 1119 const int kInputBufferSize(100);
1118 net::MockFilterContext filter_context(kInputBufferSize); 1120 MockFilterContext filter_context(kInputBufferSize);
1119 filter_context.SetMimeType("anything/mime"); 1121 filter_context.SetMimeType("anything/mime");
1120 filter_context.SetSdchResponse(true); 1122 filter_context.SetSdchResponse(true);
1121 Filter::FixupEncodingTypes(filter_context, &filter_types); 1123 Filter::FixupEncodingTypes(filter_context, &filter_types);
1122 ASSERT_EQ(filter_types.size(), 3u); 1124 ASSERT_EQ(filter_types.size(), 3u);
1123 EXPECT_EQ(filter_types[0], Filter::FILTER_TYPE_SDCH_POSSIBLE); 1125 EXPECT_EQ(filter_types[0], Filter::FILTER_TYPE_SDCH_POSSIBLE);
1124 EXPECT_EQ(filter_types[1], Filter::FILTER_TYPE_GZIP_HELPING_SDCH); 1126 EXPECT_EQ(filter_types[1], Filter::FILTER_TYPE_GZIP_HELPING_SDCH);
1125 EXPECT_EQ(filter_types[2], Filter::FILTER_TYPE_GZIP); 1127 EXPECT_EQ(filter_types[2], Filter::FILTER_TYPE_GZIP);
1126 1128
1127 // First try with a large buffer (larger than test input, or compressed data). 1129 // First try with a large buffer (larger than test input, or compressed data).
1128 filter_context.SetURL(url); 1130 filter_context.SetURL(url);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 1399
1398 // And can reset them to false. 1400 // And can reset them to false.
1399 sdch_manager_->SetAllowLatencyExperiment(url, false); 1401 sdch_manager_->SetAllowLatencyExperiment(url, false);
1400 EXPECT_FALSE(sdch_manager_->AllowLatencyExperiment(url)); 1402 EXPECT_FALSE(sdch_manager_->AllowLatencyExperiment(url));
1401 EXPECT_TRUE(sdch_manager_->AllowLatencyExperiment(url2)); 1403 EXPECT_TRUE(sdch_manager_->AllowLatencyExperiment(url2));
1402 1404
1403 sdch_manager_->SetAllowLatencyExperiment(url2, false); 1405 sdch_manager_->SetAllowLatencyExperiment(url2, false);
1404 EXPECT_FALSE(sdch_manager_->AllowLatencyExperiment(url)); 1406 EXPECT_FALSE(sdch_manager_->AllowLatencyExperiment(url));
1405 EXPECT_FALSE(sdch_manager_->AllowLatencyExperiment(url2)); 1407 EXPECT_FALSE(sdch_manager_->AllowLatencyExperiment(url2));
1406 } 1408 }
1409
1410 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698