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

Side by Side Diff: components/safe_browsing_db/v4_update_protocol_manager_unittest.cc

Issue 2241863004: Enable support for Rice encoding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@01_checksum_errors
Patch Set: Remove TODO. Update test to expect RICE as supported compression. Created 4 years, 4 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
« no previous file with comments | « components/safe_browsing_db/v4_update_protocol_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/safe_browsing_db/v4_update_protocol_manager.h" 5 #include "components/safe_browsing_db/v4_update_protocol_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 TEST_F(V4UpdateProtocolManagerTest, TestBase64EncodingUsesUrlEncoding) { 301 TEST_F(V4UpdateProtocolManagerTest, TestBase64EncodingUsesUrlEncoding) {
302 // NOTE(vakh): I handpicked this value for state by generating random strings 302 // NOTE(vakh): I handpicked this value for state by generating random strings
303 // and picked the one that leads to a '-' in the base64 url encoded request 303 // and picked the one that leads to a '-' in the base64 url encoded request
304 // output. 304 // output.
305 std::string state_minus = "z-R~3ruViQH"; 305 std::string state_minus = "z-R~3ruViQH";
306 StoreStateMap store_state_map_minus{ 306 StoreStateMap store_state_map_minus{
307 {UpdateListIdentifier(LINUX_PLATFORM, URL, MALWARE_THREAT), state_minus}}; 307 {UpdateListIdentifier(LINUX_PLATFORM, URL, MALWARE_THREAT), state_minus}};
308 std::string encoded_request_with_minus = 308 std::string encoded_request_with_minus =
309 V4UpdateProtocolManager::GetBase64SerializedUpdateRequestProto( 309 V4UpdateProtocolManager::GetBase64SerializedUpdateRequestProto(
310 store_state_map_minus); 310 store_state_map_minus);
311 EXPECT_EQ("GhcIARACGgt6LVJ-M3J1VmlRSCICIAEoAQ==", encoded_request_with_minus); 311 EXPECT_EQ("GhkIARACGgt6LVJ-M3J1VmlRSCIEIAEgAigB", encoded_request_with_minus);
312 312
313 // NOTE(vakh): Same process for chosing this string. I am representing it 313 // NOTE(vakh): Same process for chosing this string. I am representing it
314 // in base64 encoded form because the actual state value contains non-ASCII 314 // in base64 encoded form because the actual state value contains non-ASCII
315 // characters. 315 // characters.
316 std::string base64_encoded_state_underscore = "VTFfITBf4lBM"; 316 std::string base64_encoded_state_underscore = "VTFfITBf4lBM";
317 std::string state_underscore; 317 std::string state_underscore;
318 base::Base64Decode(base64_encoded_state_underscore, &state_underscore); 318 base::Base64Decode(base64_encoded_state_underscore, &state_underscore);
319 StoreStateMap store_state_map_underscore{ 319 StoreStateMap store_state_map_underscore{
320 {UpdateListIdentifier(LINUX_PLATFORM, URL, MALWARE_THREAT), 320 {UpdateListIdentifier(LINUX_PLATFORM, URL, MALWARE_THREAT),
321 state_underscore}}; 321 state_underscore}};
322 std::string encoded_request_with_underscore = 322 std::string encoded_request_with_underscore =
323 V4UpdateProtocolManager::GetBase64SerializedUpdateRequestProto( 323 V4UpdateProtocolManager::GetBase64SerializedUpdateRequestProto(
324 store_state_map_underscore); 324 store_state_map_underscore);
325 EXPECT_EQ("GhUIARACGglVMV8hMF_iUEwiAiABKAE=", 325 EXPECT_EQ("GhcIARACGglVMV8hMF_iUEwiBCABIAIoAQ==",
326 encoded_request_with_underscore); 326 encoded_request_with_underscore);
327 } 327 }
328 328
329 } // namespace safe_browsing 329 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_update_protocol_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698