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

Unified Diff: base/rand_util_unittest.cc

Issue 6873156: Move crypto_helpers from sync to base (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Follow bbretw review Created 9 years, 8 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 | « base/rand_util.cc ('k') | chrome/browser/password_manager/encryptor_password_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/rand_util_unittest.cc
diff --git a/base/rand_util_unittest.cc b/base/rand_util_unittest.cc
index 3bdb815fee15dd2890e645158676819563735f5c..d7fa37af827e8589299c4a066ef83308ca4a384a 100644
--- a/base/rand_util_unittest.cc
+++ b/base/rand_util_unittest.cc
@@ -28,6 +28,19 @@ TEST(RandUtilTest, RandDouble) {
EXPECT_LE(0.0, number);
}
+TEST(RandUtilTest, RandBytes) {
+ const size_t buffer_size = 145;
+ char buffer[buffer_size];
+ memset(buffer, 0, buffer_size);
+ base::RandBytes(buffer, buffer_size);
+ char accumulator = 0;
+ for(size_t i = 0; i < buffer_size; ++i)
+ accumulator |= buffer[i];
+ // In theory this test can fail, but it won't before the universe dies of
+ // heat death.
+ EXPECT_NE(0, accumulator);
+}
+
TEST(RandUtilTest, RandBytesAsString) {
std::string random_string = base::RandBytesAsString(0);
EXPECT_EQ(0U, random_string.size());
« no previous file with comments | « base/rand_util.cc ('k') | chrome/browser/password_manager/encryptor_password_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698