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/database_manager.h" | 5 #include "components/safe_browsing_db/database_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 db_manager_->StartOnIOThread(NULL, V4ProtocolConfig()); | 66 db_manager_->StartOnIOThread(NULL, V4ProtocolConfig()); |
67 } | 67 } |
68 | 68 |
69 void TearDown() override { | 69 void TearDown() override { |
70 base::RunLoop().RunUntilIdle(); | 70 base::RunLoop().RunUntilIdle(); |
71 db_manager_->StopOnIOThread(false); | 71 db_manager_->StopOnIOThread(false); |
72 } | 72 } |
73 | 73 |
74 std::string GetStockV4GetHashResponse() { | 74 std::string GetStockV4GetHashResponse() { |
75 ListIdentifier list_id = GetChromeUrlApiId(); | 75 ListIdentifier list_id = GetChromeUrlApiId(); |
76 FullHash full_hash = crypto::SHA256HashString("example.com/more"); | 76 FullHash full_hash = crypto::SHA256HashString("example.com/"); |
77 | 77 |
78 FindFullHashesResponse response; | 78 FindFullHashesResponse response; |
79 response.mutable_negative_cache_duration()->set_seconds(600); | 79 response.mutable_negative_cache_duration()->set_seconds(600); |
80 ThreatMatch* m = response.add_matches(); | 80 ThreatMatch* m = response.add_matches(); |
81 m->set_platform_type(list_id.platform_type()); | 81 m->set_platform_type(list_id.platform_type()); |
82 m->set_threat_entry_type(list_id.threat_entry_type()); | 82 m->set_threat_entry_type(list_id.threat_entry_type()); |
83 m->set_threat_type(list_id.threat_type()); | 83 m->set_threat_type(list_id.threat_type()); |
84 m->mutable_threat()->set_hash(full_hash); | 84 m->mutable_threat()->set_hash(full_hash); |
85 m->mutable_cache_duration()->set_seconds(300); | 85 m->mutable_cache_duration()->set_seconds(300); |
86 | 86 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 fetcher->delegate()->OnURLFetchComplete(fetcher); | 141 fetcher->delegate()->OnURLFetchComplete(fetcher); |
142 | 142 |
143 base::RunLoop().RunUntilIdle(); | 143 base::RunLoop().RunUntilIdle(); |
144 | 144 |
145 ASSERT_TRUE(client.callback_invoked()); | 145 ASSERT_TRUE(client.callback_invoked()); |
146 ASSERT_EQ(1ul, client.GetBlockedPermissions().size()); | 146 ASSERT_EQ(1ul, client.GetBlockedPermissions().size()); |
147 EXPECT_EQ("GEOLOCATION", *(client.GetBlockedPermissions().begin())); | 147 EXPECT_EQ("GEOLOCATION", *(client.GetBlockedPermissions().begin())); |
148 } | 148 } |
149 | 149 |
150 } // namespace safe_browsing | 150 } // namespace safe_browsing |
OLD | NEW |