Adding yfriedman@ as owner for the enhanced_bookmarks component.
[chromium-blink-merge.git] / net / quic / crypto / quic_random_test.cc
bloba76262572b1f34963a079ef6e6c42760026662fd
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/quic/crypto/quic_random.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace net {
10 namespace test {
12 TEST(QuicRandomTest, RandBytes) {
13 unsigned char buf1[16];
14 unsigned char buf2[16];
15 memset(buf1, 0xaf, sizeof(buf1));
16 memset(buf2, 0xaf, sizeof(buf2));
17 ASSERT_EQ(0, memcmp(buf1, buf2, sizeof(buf1)));
19 QuicRandom* rng = QuicRandom::GetInstance();
20 rng->RandBytes(buf1, sizeof(buf1));
21 EXPECT_NE(0, memcmp(buf1, buf2, sizeof(buf1)));
24 TEST(QuicRandomTest, RandUint64) {
25 QuicRandom* rng = QuicRandom::GetInstance();
26 uint64 value1 = rng->RandUint64();
27 uint64 value2 = rng->RandUint64();
28 EXPECT_NE(value1, value2);
31 TEST(QuicRandomTest, Reseed) {
32 char buf[1024];
33 memset(buf, 0xaf, sizeof(buf));
35 QuicRandom* rng = QuicRandom::GetInstance();
36 rng->Reseed(buf, sizeof(buf));
39 } // namespace test
40 } // namespace net