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

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

Issue 321283002: Clear SDCH information on "Clear browsing data" path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed memory leak. Created 6 years, 6 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
« net/base/sdch_manager.cc ('K') | « net/base/sdch_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 GURL secure_url("https://www.google.com"); 434 GURL secure_url("https://www.google.com");
435 435
436 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url)); 436 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url));
437 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(secure_url)); 437 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(secure_url));
438 438
439 SdchManager::EnableSecureSchemeSupport(true); 439 SdchManager::EnableSecureSchemeSupport(true);
440 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url)); 440 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url));
441 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(secure_url)); 441 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(secure_url));
442 } 442 }
443 443
444 TEST_F(SdchManagerTest, ClearDictionaryData) {
445 std::string dictionary_domain("x.y.z.google.com");
446 GURL blacklist_url("http://bad.chromium.org");
447
448 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
449 std::string tmp_hash;
450 std::string server_hash;
451
452 SdchManager::GenerateHash(dictionary_text, &tmp_hash, &server_hash);
453
454 EXPECT_TRUE(sdch_manager()->AddSdchDictionary(
455 dictionary_text, GURL("http://" + dictionary_domain)));
456 SdchManager::Dictionary* dictionary = NULL;
457 sdch_manager()->GetVcdiffDictionary(
458 server_hash,
459 GURL("http://" + dictionary_domain + "/random_url"),
460 &dictionary);
461 EXPECT_TRUE(dictionary);
462
463 sdch_manager()->BlacklistDomain(GURL(blacklist_url));
464 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(blacklist_url));
465
466 sdch_manager()->ClearData();
jar (doing other things) 2014/06/17 05:48:55 This is probably the line of code that was critica
Randy Smith (Not in Mondays) 2014/06/17 18:33:11 Done.
467
468 dictionary = NULL;
469 sdch_manager()->GetVcdiffDictionary(
470 server_hash,
471 GURL("http://" + dictionary_domain + "/random_url"),
472 &dictionary);
473 EXPECT_FALSE(dictionary);
474 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(blacklist_url));
475 }
476
444 } // namespace net 477 } // namespace net
445 478
OLDNEW
« net/base/sdch_manager.cc ('K') | « net/base/sdch_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698