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 "cc/test/cc_test_suite.h" | 5 #include "cc/test/cc_test_suite.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event_impl.h" | |
11 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
12 #include "base/threading/thread_id_name_manager.h" | 11 #include "base/threading/thread_id_name_manager.h" |
13 #include "cc/base/switches.h" | 12 #include "cc/base/switches.h" |
14 #include "cc/test/paths.h" | 13 #include "cc/test/paths.h" |
15 | 14 |
16 namespace cc { | 15 namespace cc { |
17 | 16 |
18 CCTestSuite::CCTestSuite(int argc, char** argv) | 17 CCTestSuite::CCTestSuite(int argc, char** argv) |
19 : base::TestSuite(argc, argv) {} | 18 : base::TestSuite(argc, argv) {} |
20 | 19 |
21 CCTestSuite::~CCTestSuite() {} | 20 CCTestSuite::~CCTestSuite() {} |
22 | 21 |
23 void CCTestSuite::Initialize() { | 22 void CCTestSuite::Initialize() { |
24 base::TestSuite::Initialize(); | 23 base::TestSuite::Initialize(); |
25 RegisterPathProvider(); | 24 RegisterPathProvider(); |
26 | 25 |
27 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
28 switches::kCCUnittestsTraceEventsToVLOG)) { | |
29 std::string category_string = | |
30 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
31 switches::kCCUnittestsTraceEventsToVLOG); | |
32 | |
33 if (!category_string.size()) | |
34 category_string = "cc"; | |
35 | |
36 base::debug::TraceLog::GetInstance()->SetEnabled( | |
37 base::debug::CategoryFilter(category_string), | |
38 base::debug::TraceLog::ECHO_TO_VLOG); | |
39 } | |
40 | |
41 message_loop_.reset(new base::MessageLoop); | 26 message_loop_.reset(new base::MessageLoop); |
42 | 27 |
43 base::ThreadIdNameManager::GetInstance()->SetName( | 28 base::ThreadIdNameManager::GetInstance()->SetName( |
44 base::PlatformThread::CurrentId(), | 29 base::PlatformThread::CurrentId(), |
45 "Main"); | 30 "Main"); |
46 } | 31 } |
47 | 32 |
48 void CCTestSuite::Shutdown() { | 33 void CCTestSuite::Shutdown() { |
49 message_loop_.reset(); | 34 message_loop_.reset(); |
50 | 35 |
51 base::TestSuite::Shutdown(); | 36 base::TestSuite::Shutdown(); |
52 } | 37 } |
53 | 38 |
54 } // namespace cc | 39 } // namespace cc |
OLD | NEW |