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 "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "content/test/test_blink_web_unit_test_support.h" |
11 #include "third_party/WebKit/public/web/WebKit.h" | 12 #include "third_party/WebKit/public/web/WebKit.h" |
12 | 13 |
13 #if defined(USE_AURA) | 14 #if defined(USE_AURA) |
14 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
15 #endif | 16 #endif |
16 | 17 |
17 #if defined(USE_X11) | 18 #if defined(USE_X11) |
18 #include <X11/Xlib.h> | 19 #include <X11/Xlib.h> |
19 #endif | 20 #endif |
20 | 21 |
21 #if !defined(OS_IOS) | |
22 #include "content/test/test_blink_web_unit_test_support.h" | |
23 #endif | |
24 | |
25 namespace content { | 22 namespace content { |
26 | 23 |
27 UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite) | 24 UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite) |
28 : test_suite_(test_suite) { | 25 : test_suite_(test_suite) { |
29 #if defined(USE_X11) | 26 #if defined(USE_X11) |
30 XInitThreads(); | 27 XInitThreads(); |
31 #endif | 28 #endif |
32 #if defined(USE_AURA) | 29 #if defined(USE_AURA) |
33 DCHECK(!aura::Env::GetInstanceDontCreate()); | 30 DCHECK(!aura::Env::GetInstanceDontCreate()); |
34 const bool create_event_source = true; | 31 const bool create_event_source = true; |
35 aura::Env::CreateInstance(create_event_source); | 32 aura::Env::CreateInstance(create_event_source); |
36 #endif | 33 #endif |
37 DCHECK(test_suite); | 34 DCHECK(test_suite); |
38 #if !defined(OS_IOS) | |
39 blink_test_support_.reset(new TestBlinkWebUnitTestSupport); | 35 blink_test_support_.reset(new TestBlinkWebUnitTestSupport); |
40 #endif | |
41 } | 36 } |
42 | 37 |
43 UnitTestTestSuite::~UnitTestTestSuite() { | 38 UnitTestTestSuite::~UnitTestTestSuite() { |
44 #if !defined(OS_IOS) | |
45 blink_test_support_.reset(); | 39 blink_test_support_.reset(); |
46 #endif | |
47 #if defined(USE_AURA) | 40 #if defined(USE_AURA) |
48 aura::Env::DeleteInstance(); | 41 aura::Env::DeleteInstance(); |
49 #endif | 42 #endif |
50 } | 43 } |
51 | 44 |
52 int UnitTestTestSuite::Run() { | 45 int UnitTestTestSuite::Run() { |
53 return test_suite_->Run(); | 46 return test_suite_->Run(); |
54 } | 47 } |
55 | 48 |
56 } // namespace content | 49 } // namespace content |
OLD | NEW |