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 "chrome/test/logging/win/test_log_collector.h" | 5 #include "chrome/test/logging/win/test_log_collector.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <ios> | 10 #include <ios> |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 file_logger_->Initialize(); | 213 file_logger_->Initialize(); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 // Invoked by the listener at test start to begin collecting logs in a file. | 217 // Invoked by the listener at test start to begin collecting logs in a file. |
218 void TestLogCollector::StartSessionForTest(const testing::TestInfo& test_info) { | 218 void TestLogCollector::StartSessionForTest(const testing::TestInfo& test_info) { |
219 if (log_temp_dir_.IsValid()) { | 219 if (log_temp_dir_.IsValid()) { |
220 std::string log_file_name(test_info.name()); | 220 std::string log_file_name(test_info.name()); |
221 std::replace(log_file_name.begin(), log_file_name.end(), '/', '_'); | 221 std::replace(log_file_name.begin(), log_file_name.end(), '/', '_'); |
222 log_file_name.append(kTraceLogExtension); | 222 log_file_name.append(kTraceLogExtension); |
223 log_file_ = log_temp_dir_.path().AppendASCII(log_file_name); | 223 log_file_ = log_temp_dir_.GetPath().AppendASCII(log_file_name); |
224 | 224 |
225 file_logger_->StartLogging(log_file_); | 225 file_logger_->StartLogging(log_file_); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 // Invoked by the listener when a test result is produced to log an event for | 229 // Invoked by the listener when a test result is produced to log an event for |
230 // the result. | 230 // the result. |
231 bool TestLogCollector::LogTestPartResult( | 231 bool TestLogCollector::LogTestPartResult( |
232 const testing::TestPartResult& test_part_result) { | 232 const testing::TestPartResult& test_part_result) { |
233 // Can't handle the event if no trace session. | 233 // Can't handle the event if no trace session. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 void InstallTestLogCollector(testing::UnitTest* unit_test) { | 280 void InstallTestLogCollector(testing::UnitTest* unit_test) { |
281 // Must be called before running any tests. | 281 // Must be called before running any tests. |
282 DCHECK(unit_test); | 282 DCHECK(unit_test); |
283 DCHECK(!unit_test->current_test_case()); | 283 DCHECK(!unit_test->current_test_case()); |
284 | 284 |
285 g_test_log_collector.Get().Initialize(unit_test); | 285 g_test_log_collector.Get().Initialize(unit_test); |
286 } | 286 } |
287 | 287 |
288 } // namespace logging_win | 288 } // namespace logging_win |
OLD | NEW |