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

Side by Side Diff: chrome/browser/safe_browsing/protocol_parser_unittest.cc

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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) 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 // Program to test the SafeBrowsing protocol parsing v2.1. 5 // Program to test the SafeBrowsing protocol parsing v2.1.
6 6
7 #include "base/hash_tables.h" 7 #include "base/hash_tables.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/safe_browsing/protocol_parser.h" 10 #include "chrome/browser/safe_browsing/protocol_parser.h"
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 safe_browsing_util::FreeChunks(&chunks); 692 safe_browsing_util::FreeChunks(&chunks);
693 } 693 }
694 694
695 TEST(SafeBrowsingProtocolParsingTest, TestVerifyUpdateMac) { 695 TEST(SafeBrowsingProtocolParsingTest, TestVerifyUpdateMac) {
696 SafeBrowsingProtocolParser parser; 696 SafeBrowsingProtocolParser parser;
697 697
698 const std::string update = 698 const std::string update =
699 "m:XIU0LiQhAPJq6dynXwHbygjS5tw=\n" 699 "m:XIU0LiQhAPJq6dynXwHbygjS5tw=\n"
700 "n:1895\n" 700 "n:1895\n"
701 "i:goog-phish-shavar\n" 701 "i:goog-phish-shavar\n"
702 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6501-6505:6501-6505,pcY 6iVeT9-CBQ3fdAF0rpnKjR1Y=\n" 702 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6501-6505:6501-6505,"
703 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6506-6510:6506-6510,SDB rYC3rX3KEPe72LOypnP6QYac=\n" 703 "pcY6iVeT9-CBQ3fdAF0rpnKjR1Y=\n"
704 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6511-6520:6511-6520,9UQ o-e7OkcsXT2wFWTAhOuWOsUs=\n" 704 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6506-6510:6506-6510,"
705 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6521-6560:6521-6560,qVN w6JIpR1q6PIXST7J4LJ9n3Zg=\n" 705 "SDBrYC3rX3KEPe72LOypnP6QYac=\n"
706 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6561-6720:6561-6720,7Oi JvCbiwvpzPITW-hQohY5NHuc=\n" 706 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6511-6520:6511-6520,"
707 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6721-6880:6721-6880,oBS 3svhoi9deIa0sWZ_gnD0ujj8=\n" 707 "9UQo-e7OkcsXT2wFWTAhOuWOsUs=\n"
708 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6881-7040:6881-7040,a0r 8Xit4VvH39xgyQHZTPczKBIE=\n" 708 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6521-6560:6521-6560,"
709 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_7041-7200:7041-7163,q53 8LChutGknBw55s6kcE2wTcvU=\n" 709 "qVNw6JIpR1q6PIXST7J4LJ9n3Zg=\n"
710 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8001-8160:8001-8024,802 6-8045,8048-8049,8051-8134,8136-8152,8155-8160,j6XXAEWnjYk9tVVLBSdQvIEq2Wg=\n" 710 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6561-6720:6561-6720,"
711 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8161-8320:8161-8215,821 7-8222,8224-8320,YaNfiqdQOt-uLCLWVLj46AZpAjQ=\n" 711 "7OiJvCbiwvpzPITW-hQohY5NHuc=\n"
712 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8321-8480:8321-8391,839 3-8399,8402,8404-8419,8421-8425,8427,8431-8433,8435-8439,8441-8443,8445-8446,844 8-8480,ALj31GQMwGiIeU3bM2ZYKITfU-U=\n" 712 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6721-6880:6721-6880,"
713 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8481-8640:8481-8500,850 2-8508,8510-8511,8513-8517,8519-8525,8527-8531,8533,8536-8539,8541-8576,8578-863 8,8640,TlQYRmS_kZ5PBAUIUyNQDq0Jprs=\n" 713 "oBS3svhoi9deIa0sWZ_gnD0ujj8=\n"
714 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8641-8800:8641-8689,869 1-8731,8733-8786,x1Qf7hdNrO8b6yym03ZzNydDS1o=\n"; 714 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6881-7040:6881-7040,"
715 "a0r8Xit4VvH39xgyQHZTPczKBIE=\n"
716 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_7041-7200:7041-7163,"
717 "q538LChutGknBw55s6kcE2wTcvU=\n"
718 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8001-8160:8001-8024,"
719 "8026-8045,8048-8049,8051-8134,8136-8152,8155-8160,"
720 "j6XXAEWnjYk9tVVLBSdQvIEq2Wg=\n"
721 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8161-8320:8161-8215,"
722 "8217-8222,8224-8320,YaNfiqdQOt-uLCLWVLj46AZpAjQ=\n"
723 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8321-8480:8321-8391,"
724 "8393-8399,8402,8404-8419,8421-8425,8427,8431-8433,8435-8439,8441-8443,"
725 "8445-8446,8448-8480,ALj31GQMwGiIeU3bM2ZYKITfU-U=\n"
726 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8481-8640:8481-8500,"
727 "8502-8508,8510-8511,8513-8517,8519-8525,8527-8531,8533,8536-8539,"
728 "8541-8576,8578-8638,8640,TlQYRmS_kZ5PBAUIUyNQDq0Jprs=\n"
729 "u:s.ytimg.com/safebrowsing/rd/goog-phish-shavar_a_8641-8800:8641-8689,"
730 "8691-8731,8733-8786,x1Qf7hdNrO8b6yym03ZzNydDS1o=\n";
715 731
716 bool re_key = false; 732 bool re_key = false;
717 bool reset = false; 733 bool reset = false;
718 int next_update = -1; 734 int next_update = -1;
719 std::vector<SBChunkDelete> deletes; 735 std::vector<SBChunkDelete> deletes;
720 std::vector<ChunkUrl> urls; 736 std::vector<ChunkUrl> urls;
721 const std::string key("58Lqn5WIP961x3zuLGo5Uw=="); 737 const std::string key("58Lqn5WIP961x3zuLGo5Uw==");
722 EXPECT_TRUE(parser.ParseUpdate(update.data(), 738 EXPECT_TRUE(parser.ParseUpdate(update.data(),
723 static_cast<int>(update.size()), key, 739 static_cast<int>(update.size()), key,
724 &next_update, &re_key, 740 &next_update, &re_key,
(...skipping 18 matching lines...) Expand all
743 const std::string key("v_aDSz6jI92WeHCOoZ07QA=="); 759 const std::string key("v_aDSz6jI92WeHCOoZ07QA==");
744 const std::string mac("W9Xp2fUcQ9V66If6Cvsrstpa4Kk="); 760 const std::string mac("W9Xp2fUcQ9V66If6Cvsrstpa4Kk=");
745 761
746 EXPECT_TRUE(parser.ParseChunk(reinterpret_cast<const char*>(chunk), 762 EXPECT_TRUE(parser.ParseChunk(reinterpret_cast<const char*>(chunk),
747 sizeof(chunk), key, mac, 763 sizeof(chunk), key, mac,
748 &re_key, &chunks)); 764 &re_key, &chunks));
749 EXPECT_FALSE(re_key); 765 EXPECT_FALSE(re_key);
750 766
751 safe_browsing_util::FreeChunks(&chunks); 767 safe_browsing_util::FreeChunks(&chunks);
752 } 768 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_parser.cc ('k') | chrome/browser/safe_browsing/safe_browsing_blocking_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698