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

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

Issue 1988433002: Replace ThreatEntryType::URL_EXPRESSION with ThreatEntryType::URL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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_local_database_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_update_protocol_manager.h" 5 #include "components/safe_browsing_db/v4_update_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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return V4UpdateProtocolManager::Create( 69 return V4UpdateProtocolManager::Create(
70 NULL, config, current_list_states, 70 NULL, config, current_list_states,
71 base::Bind(&V4UpdateProtocolManagerTest::ValidateGetUpdatesResults, 71 base::Bind(&V4UpdateProtocolManagerTest::ValidateGetUpdatesResults,
72 base::Unretained(this), expected_lurs)); 72 base::Unretained(this), expected_lurs));
73 } 73 }
74 74
75 void SetupCurrentListStates( 75 void SetupCurrentListStates(
76 base::hash_map<UpdateListIdentifier, std::string>* current_list_states) { 76 base::hash_map<UpdateListIdentifier, std::string>* current_list_states) {
77 UpdateListIdentifier list_identifier; 77 UpdateListIdentifier list_identifier;
78 list_identifier.platform_type = WINDOWS_PLATFORM; 78 list_identifier.platform_type = WINDOWS_PLATFORM;
79 list_identifier.threat_entry_type = URL_EXPRESSION; 79 list_identifier.threat_entry_type = URL;
80 list_identifier.threat_type = MALWARE_THREAT; 80 list_identifier.threat_type = MALWARE_THREAT;
81 current_list_states->insert({list_identifier, "initial_state_1"}); 81 current_list_states->insert({list_identifier, "initial_state_1"});
82 82
83 list_identifier.platform_type = WINDOWS_PLATFORM; 83 list_identifier.platform_type = WINDOWS_PLATFORM;
84 list_identifier.threat_entry_type = URL_EXPRESSION; 84 list_identifier.threat_entry_type = URL;
85 list_identifier.threat_type = UNWANTED_SOFTWARE; 85 list_identifier.threat_type = UNWANTED_SOFTWARE;
86 current_list_states->insert({list_identifier, "initial_state_2"}); 86 current_list_states->insert({list_identifier, "initial_state_2"});
87 87
88 list_identifier.platform_type = WINDOWS_PLATFORM; 88 list_identifier.platform_type = WINDOWS_PLATFORM;
89 list_identifier.threat_entry_type = BINARY_DIGEST; 89 list_identifier.threat_entry_type = BINARY_DIGEST;
90 list_identifier.threat_type = MALWARE_THREAT; 90 list_identifier.threat_type = MALWARE_THREAT;
91 current_list_states->insert({list_identifier, "initial_state_3"}); 91 current_list_states->insert({list_identifier, "initial_state_3"});
92 } 92 }
93 93
94 void SetupExpectedListUpdateResponse( 94 void SetupExpectedListUpdateResponse(
95 std::vector<ListUpdateResponse>* expected_lurs) { 95 std::vector<ListUpdateResponse>* expected_lurs) {
96 ListUpdateResponse lur; 96 ListUpdateResponse lur;
97 lur.set_platform_type(WINDOWS_PLATFORM); 97 lur.set_platform_type(WINDOWS_PLATFORM);
98 lur.set_response_type(ListUpdateResponse::PARTIAL_UPDATE); 98 lur.set_response_type(ListUpdateResponse::PARTIAL_UPDATE);
99 lur.set_threat_entry_type(URL_EXPRESSION); 99 lur.set_threat_entry_type(URL);
100 lur.set_threat_type(MALWARE_THREAT); 100 lur.set_threat_type(MALWARE_THREAT);
101 lur.set_new_client_state("new_state_1"); 101 lur.set_new_client_state("new_state_1");
102 expected_lurs->push_back(lur); 102 expected_lurs->push_back(lur);
103 103
104 lur.set_platform_type(WINDOWS_PLATFORM); 104 lur.set_platform_type(WINDOWS_PLATFORM);
105 lur.set_response_type(ListUpdateResponse::PARTIAL_UPDATE); 105 lur.set_response_type(ListUpdateResponse::PARTIAL_UPDATE);
106 lur.set_threat_entry_type(URL_EXPRESSION); 106 lur.set_threat_entry_type(URL);
107 lur.set_threat_type(UNWANTED_SOFTWARE); 107 lur.set_threat_type(UNWANTED_SOFTWARE);
108 lur.set_new_client_state("new_state_2"); 108 lur.set_new_client_state("new_state_2");
109 expected_lurs->push_back(lur); 109 expected_lurs->push_back(lur);
110 110
111 lur.set_platform_type(WINDOWS_PLATFORM); 111 lur.set_platform_type(WINDOWS_PLATFORM);
112 lur.set_response_type(ListUpdateResponse::FULL_UPDATE); 112 lur.set_response_type(ListUpdateResponse::FULL_UPDATE);
113 lur.set_threat_entry_type(BINARY_DIGEST); 113 lur.set_threat_entry_type(BINARY_DIGEST);
114 lur.set_threat_type(MALWARE_THREAT); 114 lur.set_threat_type(MALWARE_THREAT);
115 lur.set_new_client_state("new_state_3"); 115 lur.set_new_client_state("new_state_3");
116 expected_lurs->push_back(lur); 116 expected_lurs->push_back(lur);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 fetcher->SetResponseString(GetExpectedV4UpdateResponse(expected_lurs)); 292 fetcher->SetResponseString(GetExpectedV4UpdateResponse(expected_lurs));
293 fetcher->delegate()->OnURLFetchComplete(fetcher); 293 fetcher->delegate()->OnURLFetchComplete(fetcher);
294 294
295 // No error, back off multiplier is unchanged. 295 // No error, back off multiplier is unchanged.
296 EXPECT_EQ(0ul, pm->update_error_count_); 296 EXPECT_EQ(0ul, pm->update_error_count_);
297 EXPECT_EQ(1ul, pm->update_back_off_mult_); 297 EXPECT_EQ(1ul, pm->update_back_off_mult_);
298 EXPECT_TRUE(pm->IsUpdateScheduled()); 298 EXPECT_TRUE(pm->IsUpdateScheduled());
299 } 299 }
300 300
301 } // namespace safe_browsing 301 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_local_database_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698