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

Unified Diff: net/quic/core/crypto/quic_crypto_server_config_test.cc

Issue 2513113002: Remove strike-register code from QuicCryptoServerConfig (Closed)
Patch Set: Created 4 years, 1 month 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/quic/core/crypto/quic_crypto_server_config.cc ('k') | net/quic/core/quic_crypto_server_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/crypto/quic_crypto_server_config_test.cc
diff --git a/net/quic/core/crypto/quic_crypto_server_config_test.cc b/net/quic/core/crypto/quic_crypto_server_config_test.cc
index dc816a01aebfa3d26425ce6c595210a6e616e8ce..646a1294d1379fddc2eed8ef0d47e95616fdf421 100644
--- a/net/quic/core/crypto/quic_crypto_server_config_test.cc
+++ b/net/quic/core/crypto/quic_crypto_server_config_test.cc
@@ -15,7 +15,6 @@
#include "net/quic/core/crypto/crypto_secret_boxer.h"
#include "net/quic/core/crypto/crypto_server_config_protobuf.h"
#include "net/quic/core/crypto/quic_random.h"
-#include "net/quic/core/crypto/strike_register_client.h"
#include "net/quic/core/quic_flags.h"
#include "net/quic/core/quic_time.h"
#include "net/quic/test_tools/crypto_test_utils.h"
@@ -34,37 +33,6 @@ using std::vector;
namespace net {
namespace test {
-class TestStrikeRegisterClient : public StrikeRegisterClient {
- public:
- explicit TestStrikeRegisterClient(QuicCryptoServerConfig* config)
- : config_(config), is_known_orbit_called_(false) {}
-
- bool IsKnownOrbit(StringPiece orbit) const override {
- // Ensure that the strike register client lock is not held.
- QuicCryptoServerConfigPeer peer(config_);
- base::Lock* m = peer.GetStrikeRegisterClientLock();
- // In Chromium, we will dead lock if the lock is held by the current thread.
- // Chromium doesn't have AssertNotHeld API call.
- // m->AssertNotHeld();
- base::AutoLock lock(*m);
-
- is_known_orbit_called_ = true;
- return true;
- }
-
- void VerifyNonceIsValidAndUnique(StringPiece nonce,
- QuicWallTime now,
- ResultCallback* cb) override {
- LOG(FATAL) << "Not implemented";
- }
-
- bool is_known_orbit_called() { return is_known_orbit_called_; }
-
- private:
- QuicCryptoServerConfig* config_;
- mutable bool is_known_orbit_called_;
-};
-
TEST(QuicCryptoServerConfigTest, ServerConfig) {
QuicRandom* rand = QuicRandom::GetInstance();
QuicCryptoServerConfig server(QuicCryptoServerConfig::TESTING, rand,
@@ -84,22 +52,6 @@ TEST(QuicCryptoServerConfigTest, ServerConfig) {
EXPECT_LE(1u, aead.size());
}
-TEST(QuicCryptoServerConfigTest, GetOrbitIsCalledWithoutTheStrikeRegisterLock) {
- QuicRandom* rand = QuicRandom::GetInstance();
- QuicCryptoServerConfig server(QuicCryptoServerConfig::TESTING, rand,
- CryptoTestUtils::ProofSourceForTesting());
- MockClock clock;
-
- TestStrikeRegisterClient* strike_register =
- new TestStrikeRegisterClient(&server);
- server.SetStrikeRegisterClient(strike_register);
-
- QuicCryptoServerConfig::ConfigOptions options;
- std::unique_ptr<CryptoHandshakeMessage> message(
- server.AddDefaultConfig(rand, &clock, options));
- EXPECT_TRUE(strike_register->is_known_orbit_called());
-}
-
TEST(QuicCryptoServerConfigTest, CompressCerts) {
QuicCompressedCertsCache compressed_certs_cache(
QuicCompressedCertsCache::kQuicCompressedCertsCacheSize);
@@ -329,36 +281,6 @@ TEST_F(SourceAddressTokenTest, SourceAddressTokenMultipleAddresses) {
ValidateSourceAddressTokens(kPrimary, token4or6, ip6_));
}
-TEST(QuicCryptoServerConfigTest, ValidateServerNonce) {
- QuicRandom* rand = QuicRandom::GetInstance();
- QuicCryptoServerConfig server(QuicCryptoServerConfig::TESTING, rand,
- CryptoTestUtils::ProofSourceForTesting());
- QuicCryptoServerConfigPeer peer(&server);
-
- StringPiece message("hello world");
- const size_t key_size = CryptoSecretBoxer::GetKeySize();
- std::unique_ptr<uint8_t[]> key(new uint8_t[key_size]);
- memset(key.get(), 0x11, key_size);
-
- CryptoSecretBoxer boxer;
- boxer.SetKeys({string(reinterpret_cast<char*>(key.get()), key_size)});
- const string box = boxer.Box(rand, message);
- MockClock clock;
- QuicWallTime now = clock.WallNow();
- const QuicWallTime original_time = now;
- EXPECT_EQ(SERVER_NONCE_DECRYPTION_FAILURE,
- peer.ValidateServerNonce(box, now));
-
- string server_nonce = peer.NewServerNonce(rand, now);
- EXPECT_EQ(HANDSHAKE_OK, peer.ValidateServerNonce(server_nonce, now));
- EXPECT_EQ(SERVER_NONCE_NOT_UNIQUE_FAILURE,
- peer.ValidateServerNonce(server_nonce, now));
-
- now = original_time.Add(QuicTime::Delta::FromSeconds(1000 * 7));
- server_nonce = peer.NewServerNonce(rand, now);
- EXPECT_EQ(HANDSHAKE_OK, peer.ValidateServerNonce(server_nonce, now));
-}
-
class CryptoServerConfigsTest : public ::testing::Test {
public:
CryptoServerConfigsTest()
« no previous file with comments | « net/quic/core/crypto/quic_crypto_server_config.cc ('k') | net/quic/core/quic_crypto_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698