Add assertions that the empty Platform::cryptographicallyRandomValues() overrides are not being used.

These implementations are not safe and look scary if not accompanied by an assertion. Also one of the comments was incorrect.

BUG=552749

Review URL: https://codereview.chromium.org/1419293005

Cr-Commit-Position: refs/heads/master@{#359229}
diff --git a/components/test_runner/test_common.cc b/components/test_runner/test_common.cc
index ad06d52..8a096d6 100644
--- a/components/test_runner/test_common.cc
+++ b/components/test_runner/test_common.cc
@@ -6,6 +6,7 @@
 
 #include "base/lazy_instance.h"
 #include "base/macros.h"
+#include "base/rand_util.h"
 #include "third_party/WebKit/public/platform/Platform.h"
 #include "third_party/WebKit/public/web/WebKit.h"
 
@@ -30,7 +31,10 @@
   }
   ~MockBlinkPlatform() override {}
   void cryptographicallyRandomValues(unsigned char* buffer,
-                                     size_t length) override {}
+                                     size_t length) override {
+    base::RandBytes(buffer, length);
+  }
+
  private:
   DISALLOW_COPY_AND_ASSIGN(MockBlinkPlatform);
 };
diff --git a/media/blink/run_all_unittests.cc b/media/blink/run_all_unittests.cc
index 787091b..cc8c0ed 100644
--- a/media/blink/run_all_unittests.cc
+++ b/media/blink/run_all_unittests.cc
@@ -4,6 +4,7 @@
 
 #include "base/bind.h"
 #include "base/message_loop/message_loop.h"
+#include "base/rand_util.h"
 #include "base/test/launcher/unit_test_launcher.h"
 #include "base/test/test_suite.h"
 #include "build/build_config.h"
@@ -82,6 +83,7 @@
 void TestBlinkPlatformSupport::cryptographicallyRandomValues(
     unsigned char* buffer,
     size_t length) {
+  base::RandBytes(buffer, length);
 }
 
 const unsigned char* TestBlinkPlatformSupport::getTraceCategoryEnabledFlag(
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
index 127e09a..857c4a4 100644
--- a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
@@ -103,7 +103,10 @@
     {
     }
 
-    void cryptographicallyRandomValues(unsigned char* buffer, size_t length) override { }
+    void cryptographicallyRandomValues(unsigned char* buffer, size_t length) override
+    {
+        RELEASE_ASSERT_NOT_REACHED();
+    }
 
     const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) override
     {
diff --git a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
index 297b776..260b95f 100644
--- a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
@@ -147,7 +147,10 @@
         }
 
         // These blink::Platform methods must be overriden to make a usable object.
-        virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) { ASSERT_NOT_REACHED(); }
+        virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length)
+        {
+            RELEASE_ASSERT_NOT_REACHED();
+        }
         virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName)
         {
             return &kAConstUnsignedCharZero;
diff --git a/third_party/WebKit/Source/platform/TestingPlatformSupport.cpp b/third_party/WebKit/Source/platform/TestingPlatformSupport.cpp
index 7733af6..96fed1a 100644
--- a/third_party/WebKit/Source/platform/TestingPlatformSupport.cpp
+++ b/third_party/WebKit/Source/platform/TestingPlatformSupport.cpp
@@ -88,6 +88,7 @@
 
 void TestingPlatformSupport::cryptographicallyRandomValues(unsigned char* buffer, size_t length)
 {
+    RELEASE_ASSERT_NOT_REACHED();
 }
 
 const unsigned char* TestingPlatformSupport::getTraceCategoryEnabledFlag(const char* categoryName)
diff --git a/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp b/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
index e29ecb6..cafdcae 100644
--- a/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
@@ -16,7 +16,10 @@
 public:
     EmptyPlatform() {}
     ~EmptyPlatform() override {}
-    void cryptographicallyRandomValues(unsigned char* buffer, size_t length) override { }
+    void cryptographicallyRandomValues(unsigned char* buffer, size_t length) override
+    {
+        RELEASE_ASSERT_NOT_REACHED();
+    }
 };
 
 TEST(FontCache, getLastResortFallbackFont)
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp
index a128a26..a6fd744 100644
--- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp
@@ -338,7 +338,10 @@
     class CurrentThreadPlatformMock : public Platform {
     public:
         CurrentThreadPlatformMock() { }
-        virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) { ASSERT_NOT_REACHED(); }
+        virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length)
+        {
+            RELEASE_ASSERT_NOT_REACHED();
+        }
         WebThread* currentThread() override { return &m_currentThread; }
 
         void enterRunLoop() { m_currentThread.enterRunLoop(); }
diff --git a/third_party/WebKit/Source/platform/heap/RunAllTests.cpp b/third_party/WebKit/Source/platform/heap/RunAllTests.cpp
index 8ce81dd..3a74f38 100644
--- a/third_party/WebKit/Source/platform/heap/RunAllTests.cpp
+++ b/third_party/WebKit/Source/platform/heap/RunAllTests.cpp
@@ -32,7 +32,6 @@
 
 #include "platform/EventTracer.h"
 #include "platform/heap/Heap.h"
-#include "wtf/CryptographicallyRandomNumber.h"
 #include "wtf/MainThread.h"
 #include <base/bind.h>
 #include <base/test/launcher/unit_test_launcher.h>
diff --git a/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp b/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
index 8a3562c..e500aa4 100644
--- a/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
@@ -63,7 +63,10 @@
     }
 
     // Stub for pure virtual method.
-    void cryptographicallyRandomValues(unsigned char*, size_t) override { ASSERT_NOT_REACHED(); }
+    void cryptographicallyRandomValues(unsigned char*, size_t) override
+    {
+        RELEASE_ASSERT_NOT_REACHED();
+    }
 
     void setPublicSuffix(const blink::WebString& suffix)
     {
diff --git a/third_party/WebKit/Source/web/ImageDecodeBench.cpp b/third_party/WebKit/Source/web/ImageDecodeBench.cpp
index 98f7fa1..988f2e8 100644
--- a/third_party/WebKit/Source/web/ImageDecodeBench.cpp
+++ b/third_party/WebKit/Source/web/ImageDecodeBench.cpp
@@ -369,7 +369,7 @@
 
         void cryptographicallyRandomValues(unsigned char*, size_t) override
         {
-            // Do nothing: make blink::Platform use the default crypto-randoms.
+            RELEASE_ASSERT_NOT_REACHED();
         }
 
         void screenColorProfile(WebVector<char>* profile) override