diff options
author | skym <skym@chromium.org> | 2015-12-14 21:20:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-15 05:22:29 +0000 |
commit | ffff2962f67fa072643ff5f69a74165718aa274e (patch) | |
tree | b89fc8d6684604fb78ffc9098d58d2102136ee0d /sync/syncable | |
parent | eab5c55815be54a878e9a79aa68920a3d6db4a93 (diff) | |
download | chromium_src-ffff2962f67fa072643ff5f69a74165718aa274e.zip chromium_src-ffff2962f67fa072643ff5f69a74165718aa274e.tar.gz chromium_src-ffff2962f67fa072643ff5f69a74165718aa274e.tar.bz2 |
[Sync] Replace directory unittest rand with base::RandInt to fix lint warnings.
BUG=567301
Review URL: https://codereview.chromium.org/1520573003
Cr-Commit-Position: refs/heads/master@{#365157}
Diffstat (limited to 'sync/syncable')
-rw-r--r-- | sync/syncable/directory_unittest.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sync/syncable/directory_unittest.cc b/sync/syncable/directory_unittest.cc index c5eae75..dc83e61 100644 --- a/sync/syncable/directory_unittest.cc +++ b/sync/syncable/directory_unittest.cc @@ -4,6 +4,9 @@ #include "sync/syncable/directory_unittest.h" +#include <cstdlib> + +#include "base/rand_util.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/test/values_test_util.h" @@ -1665,12 +1668,12 @@ class StressTransactionsDelegate : public base::PlatformThread::Delegate { std::string path_name; for (int i = 0; i < 20; ++i) { - const int rand_action = rand() % 10; + const int rand_action = base::RandInt(0, 9); if (rand_action < 4 && !path_name.empty()) { ReadTransaction trans(FROM_HERE, dir_); EXPECT_EQ(1, CountEntriesWithName(&trans, trans.root_id(), path_name)); base::PlatformThread::Sleep( - base::TimeDelta::FromMilliseconds(rand() % 10)); + base::TimeDelta::FromMilliseconds(base::RandInt(0, 9))); } else { std::string unique_name = base::StringPrintf("%d.%d", thread_number_, entry_count++); @@ -1679,9 +1682,9 @@ class StressTransactionsDelegate : public base::PlatformThread::Delegate { MutableEntry e(&trans, CREATE, BOOKMARKS, trans.root_id(), path_name); EXPECT_TRUE(e.good()); base::PlatformThread::Sleep( - base::TimeDelta::FromMilliseconds(rand() % 20)); + base::TimeDelta::FromMilliseconds(base::RandInt(0, 19))); e.PutIsUnsynced(true); - if (e.PutId(TestIdFactory::FromNumber(rand())) && + if (e.PutId(TestIdFactory::FromNumber(base::RandInt(0, RAND_MAX))) && e.GetId().ServerKnows() && !e.GetId().IsRoot()) { e.PutBaseVersion(1); } |