| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void SetUp() override { | 72 void SetUp() override { |
| 73 PlatformTest::SetUp(); | 73 PlatformTest::SetUp(); |
| 74 callback_called_ = false; | 74 callback_called_ = false; |
| 75 } | 75 } |
| 76 | 76 |
| 77 std::unique_ptr<V4GetHashProtocolManager> CreateProtocolManager() { | 77 std::unique_ptr<V4GetHashProtocolManager> CreateProtocolManager() { |
| 78 V4ProtocolConfig config; | 78 V4ProtocolConfig config; |
| 79 config.client_name = kClient; | 79 config.client_name = kClient; |
| 80 config.version = kAppVer; | 80 config.version = kAppVer; |
| 81 config.key_param = kKeyParam; | 81 config.key_param = kKeyParam; |
| 82 base::hash_set<UpdateListIdentifier> stores_to_look( | 82 std::unordered_set<UpdateListIdentifier> stores_to_look( |
| 83 {GetUrlMalwareId(), GetChromeUrlApiId()}); | 83 {GetUrlMalwareId(), GetChromeUrlApiId()}); |
| 84 return V4GetHashProtocolManager::Create(NULL, stores_to_look, config); | 84 return V4GetHashProtocolManager::Create(NULL, stores_to_look, config); |
| 85 } | 85 } |
| 86 | 86 |
| 87 static void SetupFetcherToReturnOKResponse( | 87 static void SetupFetcherToReturnOKResponse( |
| 88 const net::TestURLFetcherFactory& factory, | 88 const net::TestURLFetcherFactory& factory, |
| 89 const std::vector<ResponseInfo>& infos) { | 89 const std::vector<ResponseInfo>& infos) { |
| 90 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 90 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
| 91 DCHECK(fetcher); | 91 DCHECK(fetcher); |
| 92 fetcher->set_status(net::URLRequestStatus()); | 92 fetcher->set_status(net::URLRequestStatus()); |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 full_hash = FullHash("Everything's shiny, Cap'n."); | 723 full_hash = FullHash("Everything's shiny, Cap'n."); |
| 724 info = ResponseInfo(full_hash, GetChromeUrlApiId()); | 724 info = ResponseInfo(full_hash, GetChromeUrlApiId()); |
| 725 info.key_values.emplace_back("permission", "GEOLOCATION"); | 725 info.key_values.emplace_back("permission", "GEOLOCATION"); |
| 726 infos.push_back(info); | 726 infos.push_back(info); |
| 727 SetupFetcherToReturnOKResponse(factory, infos); | 727 SetupFetcherToReturnOKResponse(factory, infos); |
| 728 | 728 |
| 729 EXPECT_TRUE(callback_called()); | 729 EXPECT_TRUE(callback_called()); |
| 730 } | 730 } |
| 731 | 731 |
| 732 } // namespace safe_browsing | 732 } // namespace safe_browsing |
| OLD | NEW |