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

Side by Side Diff: components/safe_browsing_db/database_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 | « no previous file | components/safe_browsing_db/v4_get_hash_protocol_manager.h » ('j') | 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/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
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
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
OLDNEW
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_get_hash_protocol_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698