| 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 #ifndef CONTENT_PUBLIC_TEST_UNITTEST_TEST_SUITE_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_UNITTEST_TEST_SUITE_H_ |
| 6 #define CONTENT_PUBLIC_TEST_UNITTEST_TEST_SUITE_H_ | 6 #define CONTENT_PUBLIC_TEST_UNITTEST_TEST_SUITE_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 | 12 |
| 12 namespace base { | 13 namespace base { |
| 13 class TestSuite; | 14 class TestSuite; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 class TestBlinkWebUnitTestSupport; | 18 class TestBlinkWebUnitTestSupport; |
| 18 | 19 |
| 19 // A special test suite that also initializes WebKit once for all unittests. | 20 // A special test suite that also initializes WebKit once for all unittests. |
| 20 // This is useful for two reasons: | 21 // This is useful for two reasons: |
| 21 // 1. It allows the use of some primitive WebKit data types like WebString. | 22 // 1. It allows the use of some primitive WebKit data types like WebString. |
| 22 // 2. Individual unittests should not be initting WebKit on their own, initting | 23 // 2. Individual unittests should not be initting WebKit on their own, initting |
| 23 // it here ensures attempts to do so within an individual test will fail. | 24 // it here ensures attempts to do so within an individual test will fail. |
| 24 class UnitTestTestSuite { | 25 class UnitTestTestSuite { |
| 25 public: | 26 public: |
| 26 // Takes ownership of |test_suite|. | 27 // Takes ownership of |test_suite|. |
| 27 explicit UnitTestTestSuite(base::TestSuite* test_suite); | 28 explicit UnitTestTestSuite(base::TestSuite* test_suite); |
| 28 ~UnitTestTestSuite(); | 29 ~UnitTestTestSuite(); |
| 29 | 30 |
| 30 int Run(); | 31 int Run(); |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 scoped_ptr<base::TestSuite> test_suite_; | 34 std::unique_ptr<base::TestSuite> test_suite_; |
| 34 | 35 |
| 35 scoped_ptr<TestBlinkWebUnitTestSupport> blink_test_support_; | 36 std::unique_ptr<TestBlinkWebUnitTestSupport> blink_test_support_; |
| 36 | 37 |
| 37 DISALLOW_COPY_AND_ASSIGN(UnitTestTestSuite); | 38 DISALLOW_COPY_AND_ASSIGN(UnitTestTestSuite); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 } // namespace content | 41 } // namespace content |
| 41 | 42 |
| 42 #endif // CONTENT_PUBLIC_TEST_UNITTEST_TEST_SUITE_H_ | 43 #endif // CONTENT_PUBLIC_TEST_UNITTEST_TEST_SUITE_H_ |
| OLD | NEW |