Index: crypto/random_unittest.cc |
diff --git a/crypto/random_unittest.cc b/crypto/random_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e173e0921620e5a7f25d48fbcaf9bee8545f44a1 |
--- /dev/null |
+++ b/crypto/random_unittest.cc |
@@ -0,0 +1,16 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "crypto/random.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+TEST(CryptoHelpers, GetRandomBytes) { |
+ for (int i = 1; i < 25; ++i) { |
+ std::string random_bytes(i+1, ' '); |
+ do { |
+ GetRandomBytes(&random_bytes[0], i); |
+ ASSERT_EQ(random_bytes[i], ' '); |
+ } while (random_bytes[i - 1] == ' '); |
+ } |
+} |