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/WebKit/chromium/public/WebKit.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" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatfo
rmSupport.h" |
12 #include "webkit/compositor_bindings/web_compositor_support_impl.h" | 12 #include "webkit/compositor_bindings/web_compositor_support_impl.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
| 16 #if !defined(OS_IOS) |
16 // A stubbed out WebKit platform support impl. | 17 // A stubbed out WebKit platform support impl. |
17 class UnitTestTestSuite::UnitTestWebKitPlatformSupport | 18 class UnitTestTestSuite::UnitTestWebKitPlatformSupport |
18 : public WebKit::WebKitPlatformSupport { | 19 : public WebKit::WebKitPlatformSupport { |
19 public: | 20 public: |
20 UnitTestWebKitPlatformSupport() {} | 21 UnitTestWebKitPlatformSupport() {} |
21 virtual ~UnitTestWebKitPlatformSupport() {} | 22 virtual ~UnitTestWebKitPlatformSupport() {} |
22 virtual void cryptographicallyRandomValues(unsigned char* buffer, | 23 virtual void cryptographicallyRandomValues(unsigned char* buffer, |
23 size_t length) OVERRIDE { | 24 size_t length) OVERRIDE { |
24 base::RandBytes(buffer, length); | 25 base::RandBytes(buffer, length); |
25 } | 26 } |
26 virtual const unsigned char* getTraceCategoryEnabledFlag( | 27 virtual const unsigned char* getTraceCategoryEnabledFlag( |
27 const char* categoryName) { | 28 const char* categoryName) { |
28 // Causes tracing macros to be disabled. | 29 // Causes tracing macros to be disabled. |
29 static const unsigned char kEnabled = 0; | 30 static const unsigned char kEnabled = 0; |
30 return &kEnabled; | 31 return &kEnabled; |
31 } | 32 } |
32 | 33 |
33 virtual WebKit::WebCompositorSupport* compositorSupport() { | 34 virtual WebKit::WebCompositorSupport* compositorSupport() { |
34 return &compositor_support_; | 35 return &compositor_support_; |
35 } | 36 } |
36 | 37 |
37 private: | 38 private: |
38 webkit::WebCompositorSupportImpl compositor_support_; | 39 webkit::WebCompositorSupportImpl compositor_support_; |
39 }; | 40 }; |
| 41 #endif // !OS_IOS |
40 | 42 |
41 UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite) | 43 UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite) |
42 : test_suite_(test_suite) { | 44 : test_suite_(test_suite) { |
43 DCHECK(test_suite); | 45 DCHECK(test_suite); |
| 46 #if !defined(OS_IOS) |
44 webkit_platform_support_.reset(new UnitTestWebKitPlatformSupport); | 47 webkit_platform_support_.reset(new UnitTestWebKitPlatformSupport); |
45 WebKit::initialize(webkit_platform_support_.get()); | 48 WebKit::initialize(webkit_platform_support_.get()); |
| 49 #endif |
46 } | 50 } |
47 | 51 |
48 UnitTestTestSuite::~UnitTestTestSuite() { | 52 UnitTestTestSuite::~UnitTestTestSuite() { |
| 53 #if !defined(OS_IOS) |
49 WebKit::shutdown(); | 54 WebKit::shutdown(); |
| 55 #endif |
50 } | 56 } |
51 | 57 |
52 int UnitTestTestSuite::Run() { | 58 int UnitTestTestSuite::Run() { |
53 return test_suite_->Run(); | 59 return test_suite_->Run(); |
54 } | 60 } |
55 | 61 |
56 } // namespace content | 62 } // namespace content |
OLD | NEW |