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