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

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

Issue 2391933002: Safe Browsing: Only check origins for API checks. (Closed)
Patch Set: Created 4 years, 2 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_get_hash_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_get_hash_protocol_manager.h" 5 #include "components/safe_browsing_db/v4_get_hash_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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 ThreatMetadata expected_md; 701 ThreatMetadata expected_md;
702 expected_md.api_permissions.insert("NOTIFICATIONS"); 702 expected_md.api_permissions.insert("NOTIFICATIONS");
703 expected_md.api_permissions.insert("AUDIO_CAPTURE"); 703 expected_md.api_permissions.insert("AUDIO_CAPTURE");
704 std::unique_ptr<V4GetHashProtocolManager> pm(CreateProtocolManager()); 704 std::unique_ptr<V4GetHashProtocolManager> pm(CreateProtocolManager());
705 pm->GetFullHashesWithApis( 705 pm->GetFullHashesWithApis(
706 url, base::Bind(&V4GetHashProtocolManagerTest::ValidateGetV4ApiResults, 706 url, base::Bind(&V4GetHashProtocolManagerTest::ValidateGetV4ApiResults,
707 base::Unretained(this), expected_md)); 707 base::Unretained(this), expected_md));
708 708
709 // The following two random looking strings value are two of the full hashes 709 // The following two random looking strings value are two of the full hashes
710 // produced by UrlToFullHashes in v4_protocol_manager_util.h for the URL: 710 // produced by UrlToFullHashes in v4_protocol_manager_util.h for the URL:
711 // "https://www.example.com/more" 711 // "https://www.example.com"
712 std::vector<ResponseInfo> infos; 712 std::vector<ResponseInfo> infos;
713 FullHash full_hash; 713 FullHash full_hash;
714 base::Base64Decode("1ZzJ0/7NjPkg6t0DAS8L5Jf7jA48Pn7opQcP4UXYeXc=", 714 base::Base64Decode("1ZzJ0/7NjPkg6t0DAS8L5Jf7jA48Pn7opQcP4UXYeXc=",
715 &full_hash); 715 &full_hash);
716 ResponseInfo info(full_hash, GetChromeUrlApiId()); 716 ResponseInfo info(full_hash, GetChromeUrlApiId());
717 info.key_values.emplace_back("permission", "NOTIFICATIONS"); 717 info.key_values.emplace_back("permission", "NOTIFICATIONS");
718 infos.push_back(info); 718 infos.push_back(info);
719 719
720 base::Base64Decode("4rPDSdcei1BiCOPnj9kgsy2O6Ua6X3iFBakqphB3ZfA=", 720 base::Base64Decode("c9mG4AkGXxgsELy2pF2z1u2pSY-JMGVK8mU_ipOM2AE=",
721 &full_hash); 721 &full_hash);
722 info = ResponseInfo(full_hash, GetChromeUrlApiId()); 722 info = ResponseInfo(full_hash, GetChromeUrlApiId());
723 info.key_values.emplace_back("permission", "AUDIO_CAPTURE"); 723 info.key_values.emplace_back("permission", "AUDIO_CAPTURE");
724 infos.push_back(info); 724 infos.push_back(info);
725 725
726 full_hash = FullHash("Everything's shiny, Cap'n."); 726 full_hash = FullHash("Everything's shiny, Cap'n.");
727 info = ResponseInfo(full_hash, GetChromeUrlApiId()); 727 info = ResponseInfo(full_hash, GetChromeUrlApiId());
728 info.key_values.emplace_back("permission", "GEOLOCATION"); 728 info.key_values.emplace_back("permission", "GEOLOCATION");
729 infos.push_back(info); 729 infos.push_back(info);
730 SetupFetcherToReturnOKResponse(factory, infos); 730 SetupFetcherToReturnOKResponse(factory, infos);
731 731
732 EXPECT_TRUE(callback_called()); 732 EXPECT_TRUE(callback_called());
733 } 733 }
734 734
735 } // namespace safe_browsing 735 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_get_hash_protocol_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698