Pull the new r369476 of base library from Chromium

The merge was done against r369476 which corresponds to git commit
0471d0e2e2ef4a544a63481a389e1df33ea7c00a of Jan 14, 2016

Change-Id: Ie6894cf65424cc5ad115110faccd51602b2d1234
Reviewed-on: https://weave-review.googlesource.com/2225
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/third_party/chromium/base/rand_util_unittest.cc b/third_party/chromium/base/rand_util_unittest.cc
index 384125b..fc0233d 100644
--- a/third_party/chromium/base/rand_util_unittest.cc
+++ b/third_party/chromium/base/rand_util_unittest.cc
@@ -4,6 +4,9 @@
 
 #include "base/rand_util.h"
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include <algorithm>
 #include <limits>
 
@@ -20,10 +23,16 @@
 
 }  // namespace
 
-TEST(RandUtilTest, SameMinAndMax) {
+TEST(RandUtilTest, RandInt) {
   EXPECT_EQ(base::RandInt(0, 0), 0);
   EXPECT_EQ(base::RandInt(kIntMin, kIntMin), kIntMin);
   EXPECT_EQ(base::RandInt(kIntMax, kIntMax), kIntMax);
+
+  // Check that the DCHECKS in RandInt() don't fire due to internal overflow.
+  // There was a 50% chance of that happening, so calling it 40 times means
+  // the chances of this passing by accident are tiny (9e-13).
+  for (int i = 0; i < 40; ++i)
+    base::RandInt(kIntMin, kIntMax);
 }
 
 TEST(RandUtilTest, RandDouble) {
@@ -62,7 +71,7 @@
 TEST(RandUtilTest, RandGeneratorForRandomShuffle) {
   EXPECT_EQ(base::RandGenerator(1), 0U);
   EXPECT_LE(std::numeric_limits<ptrdiff_t>::max(),
-            std::numeric_limits<int64>::max());
+            std::numeric_limits<int64_t>::max());
 }
 
 TEST(RandUtilTest, RandGeneratorIsUniform) {
@@ -78,16 +87,17 @@
   // top half. A bit of calculus care of jar@ shows that the largest
   // measurable delta is when the top of the range is 3/4ths of the
   // way, so that's what we use in the test.
-  const uint64 kTopOfRange = (std::numeric_limits<uint64>::max() / 4ULL) * 3ULL;
-  const uint64 kExpectedAverage = kTopOfRange / 2ULL;
-  const uint64 kAllowedVariance = kExpectedAverage / 50ULL;  // +/- 2%
+  const uint64_t kTopOfRange =
+      (std::numeric_limits<uint64_t>::max() / 4ULL) * 3ULL;
+  const uint64_t kExpectedAverage = kTopOfRange / 2ULL;
+  const uint64_t kAllowedVariance = kExpectedAverage / 50ULL;  // +/- 2%
   const int kMinAttempts = 1000;
   const int kMaxAttempts = 1000000;
 
   double cumulative_average = 0.0;
   int count = 0;
   while (count < kMaxAttempts) {
-    uint64 value = base::RandGenerator(kTopOfRange);
+    uint64_t value = base::RandGenerator(kTopOfRange);
     cumulative_average = (count * cumulative_average + value) / (count + 1);
 
     // Don't quit too quickly for things to start converging, or we may have
@@ -108,13 +118,13 @@
 TEST(RandUtilTest, RandUint64ProducesBothValuesOfAllBits) {
   // This tests to see that our underlying random generator is good
   // enough, for some value of good enough.
-  uint64 kAllZeros = 0ULL;
-  uint64 kAllOnes = ~kAllZeros;
-  uint64 found_ones = kAllZeros;
-  uint64 found_zeros = kAllOnes;
+  uint64_t kAllZeros = 0ULL;
+  uint64_t kAllOnes = ~kAllZeros;
+  uint64_t found_ones = kAllZeros;
+  uint64_t found_zeros = kAllOnes;
 
   for (size_t i = 0; i < 1000; ++i) {
-    uint64 value = base::RandUint64();
+    uint64_t value = base::RandUint64();
     found_ones |= value;
     found_zeros &= value;