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> |
| 8 |
| 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event_impl.h" |
7 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/threading/thread_id_name_manager.h" |
| 13 #include "cc/base/switches.h" |
8 #include "cc/test/paths.h" | 14 #include "cc/test/paths.h" |
9 | 15 |
10 namespace cc { | 16 namespace cc { |
11 | 17 |
12 CCTestSuite::CCTestSuite(int argc, char** argv) | 18 CCTestSuite::CCTestSuite(int argc, char** argv) |
13 : base::TestSuite(argc, argv) {} | 19 : base::TestSuite(argc, argv) {} |
14 | 20 |
15 CCTestSuite::~CCTestSuite() {} | 21 CCTestSuite::~CCTestSuite() {} |
16 | 22 |
17 void CCTestSuite::Initialize() { | 23 void CCTestSuite::Initialize() { |
18 base::TestSuite::Initialize(); | 24 base::TestSuite::Initialize(); |
19 RegisterPathProvider(); | 25 RegisterPathProvider(); |
| 26 |
| 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 |
20 message_loop_.reset(new base::MessageLoop); | 41 message_loop_.reset(new base::MessageLoop); |
| 42 |
| 43 base::ThreadIdNameManager::GetInstance()->SetName( |
| 44 base::PlatformThread::CurrentId(), |
| 45 "Main"); |
21 } | 46 } |
22 | 47 |
23 void CCTestSuite::Shutdown() { | 48 void CCTestSuite::Shutdown() { |
24 message_loop_.reset(); | 49 message_loop_.reset(); |
25 | 50 |
26 base::TestSuite::Shutdown(); | 51 base::TestSuite::Shutdown(); |
27 } | 52 } |
28 | 53 |
29 } // namespace cc | 54 } // namespace cc |
OLD | NEW |