| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/public/test/unittest_test_suite.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/rand_util.h" | |
| 9 #include "base/test/test_suite.h" | |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatfo
rmSupport.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 // A stubbed out WebKit platform support impl. | |
| 16 class UnitTestTestSuite::UnitTestWebKitPlatformSupport | |
| 17 : public WebKit::WebKitPlatformSupport { | |
| 18 public: | |
| 19 UnitTestWebKitPlatformSupport() {} | |
| 20 virtual ~UnitTestWebKitPlatformSupport() {} | |
| 21 virtual void cryptographicallyRandomValues(unsigned char* buffer, | |
| 22 size_t length) OVERRIDE { | |
| 23 base::RandBytes(buffer, length); | |
| 24 } | |
| 25 virtual const unsigned char* getTraceCategoryEnabledFlag( | |
| 26 const char* categoryName) { | |
| 27 // Causes tracing macros to be disabled. | |
| 28 static const unsigned char kEnabled = 0; | |
| 29 return &kEnabled; | |
| 30 } | |
| 31 }; | |
| 32 | |
| 33 UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite) | |
| 34 : test_suite_(test_suite) { | |
| 35 DCHECK(test_suite); | |
| 36 webkit_platform_support_.reset(new UnitTestWebKitPlatformSupport); | |
| 37 WebKit::initialize(webkit_platform_support_.get()); | |
| 38 } | |
| 39 | |
| 40 UnitTestTestSuite::~UnitTestTestSuite() { | |
| 41 WebKit::shutdown(); | |
| 42 } | |
| 43 | |
| 44 int UnitTestTestSuite::Run() { | |
| 45 return test_suite_->Run(); | |
| 46 } | |
| 47 | |
| 48 } // namespace content | |
| OLD | NEW |