| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |