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

Unified Diff: net/http/transport_security_state_unittest.cc

Issue 663903002: net: fix bug in compact HSTS representation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/transport_security_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/transport_security_state_unittest.cc
diff --git a/net/http/transport_security_state_unittest.cc b/net/http/transport_security_state_unittest.cc
index 67e6f9118524f84885a13bf2d4d6c4c2f944bb4c..8a2ebe87e94f40a402afb1d39ec4c82f42d0b757 100644
--- a/net/http/transport_security_state_unittest.cc
+++ b/net/http/transport_security_state_unittest.cc
@@ -10,6 +10,7 @@
#include "base/base64.h"
#include "base/files/file_path.h"
+#include "base/rand_util.h"
#include "base/sha1.h"
#include "base/strings/string_piece.h"
#include "crypto/sha2.h"
@@ -92,6 +93,28 @@ TEST_F(TransportSecurityStateTest, MatchesCase1) {
EXPECT_TRUE(state.GetDynamicDomainState("yahoo.com", &domain_state));
}
+TEST_F(TransportSecurityStateTest, Fuzz) {
+ TransportSecurityState state;
+ TransportSecurityState::DomainState domain_state;
+
+ EnableStaticPins(&state);
+
+ for (size_t i = 0; i < 128; i++) {
+ std::string hostname;
+
+ for (;;) {
+ if (base::RandInt(0, 16) == 7) {
+ break;
+ }
+ if (i > 0 && base::RandInt(0, 7) == 7) {
+ hostname.append(1, '.');
+ }
+ hostname.append(1, 'a' + base::RandInt(0, 25));
+ }
+ state.GetStaticDomainState(hostname, &domain_state);
+ }
+}
+
TEST_F(TransportSecurityStateTest, MatchesCase2) {
TransportSecurityState state;
TransportSecurityState::DomainState domain_state;
« no previous file with comments | « net/http/transport_security_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698