summaryrefslogtreecommitdiffstats
path: root/sync/syncable
diff options
context:
space:
mode:
authorskym <skym@chromium.org>2015-12-14 21:20:33 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-15 05:22:29 +0000
commitffff2962f67fa072643ff5f69a74165718aa274e (patch)
treeb89fc8d6684604fb78ffc9098d58d2102136ee0d /sync/syncable
parenteab5c55815be54a878e9a79aa68920a3d6db4a93 (diff)
downloadchromium_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.cc11
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);
}