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

Unified Diff: net/http/http_security_headers_unittest.cc

Issue 2943703002: Use ContainsValue() instead of std::find() in net/ (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_security_headers.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_security_headers_unittest.cc
diff --git a/net/http/http_security_headers_unittest.cc b/net/http/http_security_headers_unittest.cc
index 2ddd6b1cdbf1f9b702e0c0635b38301419bb6972..7f1148a170979031440bfff7f94126fa172754e1 100644
--- a/net/http/http_security_headers_unittest.cc
+++ b/net/http/http_security_headers_unittest.cc
@@ -3,9 +3,9 @@
// found in the LICENSE file.
#include <stdint.h>
-#include <algorithm>
#include "base/base64.h"
+#include "base/stl_util.h"
#include "base/strings/string_piece.h"
#include "crypto/sha2.h"
#include "net/base/host_port_pair.h"
@@ -693,14 +693,9 @@ TEST_F(HttpSecurityHeadersTest, UpdateDynamicPKPOnly) {
EXPECT_EQ(2UL, dynamic_pkp_state.spki_hashes.size());
EXPECT_EQ(report_uri, dynamic_pkp_state.report_uri);
- HashValueVector::const_iterator hash =
- std::find(dynamic_pkp_state.spki_hashes.begin(),
- dynamic_pkp_state.spki_hashes.end(), good_hash);
- EXPECT_NE(dynamic_pkp_state.spki_hashes.end(), hash);
+ EXPECT_TRUE(base::ContainsValue(dynamic_pkp_state.spki_hashes, good_hash));
- hash = std::find(dynamic_pkp_state.spki_hashes.begin(),
- dynamic_pkp_state.spki_hashes.end(), backup_hash);
- EXPECT_NE(dynamic_pkp_state.spki_hashes.end(), hash);
+ EXPECT_TRUE(base::ContainsValue(dynamic_pkp_state.spki_hashes, backup_hash));
// Expect the overall state to reflect the header, too.
EXPECT_TRUE(state.HasPublicKeyPins(domain));
@@ -719,13 +714,11 @@ TEST_F(HttpSecurityHeadersTest, UpdateDynamicPKPOnly) {
EXPECT_EQ(2UL, new_dynamic_pkp_state.spki_hashes.size());
EXPECT_EQ(report_uri, new_dynamic_pkp_state.report_uri);
- hash = std::find(new_dynamic_pkp_state.spki_hashes.begin(),
- new_dynamic_pkp_state.spki_hashes.end(), good_hash);
- EXPECT_NE(new_dynamic_pkp_state.spki_hashes.end(), hash);
+ EXPECT_TRUE(
+ base::ContainsValue(new_dynamic_pkp_state.spki_hashes, good_hash));
- hash = std::find(new_dynamic_pkp_state.spki_hashes.begin(),
- new_dynamic_pkp_state.spki_hashes.end(), backup_hash);
- EXPECT_NE(new_dynamic_pkp_state.spki_hashes.end(), hash);
+ EXPECT_TRUE(
+ base::ContainsValue(new_dynamic_pkp_state.spki_hashes, backup_hash));
}
TEST_F(HttpSecurityHeadersTest, UpdateDynamicPKPMaxAge0) {
« no previous file with comments | « net/http/http_security_headers.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698