| OLD | NEW |
| 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" | |
| 9 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 10 #include "chrome/browser/safe_browsing/protocol_parser.h" | 9 #include "chrome/browser/safe_browsing/protocol_parser.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 11 |
| 13 | 12 |
| 14 // Test parsing one add chunk. | 13 // Test parsing one add chunk. |
| 15 TEST(SafeBrowsingProtocolParsingTest, TestAddChunk) { | 14 TEST(SafeBrowsingProtocolParsingTest, TestAddChunk) { |
| 16 std::string add_chunk("a:1:4:35\naaaax1111\0032222333344447777\00288889999"); | 15 std::string add_chunk("a:1:4:35\naaaax1111\0032222333344447777\00288889999"); |
| 17 add_chunk[13] = '\0'; | 16 add_chunk[13] = '\0'; |
| 18 | 17 |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 const std::string key("v_aDSz6jI92WeHCOoZ07QA=="); | 758 const std::string key("v_aDSz6jI92WeHCOoZ07QA=="); |
| 760 const std::string mac("W9Xp2fUcQ9V66If6Cvsrstpa4Kk="); | 759 const std::string mac("W9Xp2fUcQ9V66If6Cvsrstpa4Kk="); |
| 761 | 760 |
| 762 EXPECT_TRUE(parser.ParseChunk(reinterpret_cast<const char*>(chunk), | 761 EXPECT_TRUE(parser.ParseChunk(reinterpret_cast<const char*>(chunk), |
| 763 sizeof(chunk), key, mac, | 762 sizeof(chunk), key, mac, |
| 764 &re_key, &chunks)); | 763 &re_key, &chunks)); |
| 765 EXPECT_FALSE(re_key); | 764 EXPECT_FALSE(re_key); |
| 766 | 765 |
| 767 safe_browsing_util::FreeChunks(&chunks); | 766 safe_browsing_util::FreeChunks(&chunks); |
| 768 } | 767 } |
| OLD | NEW |