| 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> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/files/scoped_temp_dir.h" |
| 16 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
| 17 #include "base/logging.h" | 18 #include "base/logging.h" |
| 18 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/scoped_temp_dir.h" | |
| 20 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
| 21 #include "chrome/test/base/test_switches.h" | 21 #include "chrome/test/base/test_switches.h" |
| 22 #include "chrome/test/logging/win/file_logger.h" | 22 #include "chrome/test/logging/win/file_logger.h" |
| 23 #include "chrome/test/logging/win/log_file_printer.h" | 23 #include "chrome/test/logging/win/log_file_printer.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 namespace logging_win { | 26 namespace logging_win { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 scoped_ptr<testing::TestEventListener> default_result_printer_; | 129 scoped_ptr<testing::TestEventListener> default_result_printer_; |
| 130 | 130 |
| 131 DISALLOW_COPY_AND_ASSIGN(EventListener); | 131 DISALLOW_COPY_AND_ASSIGN(EventListener); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 // The Google Test unit test into which the collector has been installed. | 134 // The Google Test unit test into which the collector has been installed. |
| 135 testing::UnitTest* unit_test_; | 135 testing::UnitTest* unit_test_; |
| 136 | 136 |
| 137 // A temporary directory into which a log file is placed for the duration of | 137 // A temporary directory into which a log file is placed for the duration of |
| 138 // each test. Created/destroyed at collector SetUp and TearDown. | 138 // each test. Created/destroyed at collector SetUp and TearDown. |
| 139 ScopedTempDir log_temp_dir_; | 139 base::ScopedTempDir log_temp_dir_; |
| 140 | 140 |
| 141 // The test logger. Initialized/Unintitialized at collector SetUp and | 141 // The test logger. Initialized/Unintitialized at collector SetUp and |
| 142 // TearDown. | 142 // TearDown. |
| 143 scoped_ptr<FileLogger> file_logger_; | 143 scoped_ptr<FileLogger> file_logger_; |
| 144 | 144 |
| 145 // The current log file. Valid only during a test. | 145 // The current log file. Valid only during a test. |
| 146 FilePath log_file_; | 146 FilePath log_file_; |
| 147 | 147 |
| 148 // True if --also-emit-success-logs was specified on the command line. | 148 // True if --also-emit-success-logs was specified on the command line. |
| 149 bool also_emit_success_logs_; | 149 bool also_emit_success_logs_; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 void InstallTestLogCollector(testing::UnitTest* unit_test) { | 282 void InstallTestLogCollector(testing::UnitTest* unit_test) { |
| 283 // Must be called before running any tests. | 283 // Must be called before running any tests. |
| 284 DCHECK(unit_test); | 284 DCHECK(unit_test); |
| 285 DCHECK(!unit_test->current_test_case()); | 285 DCHECK(!unit_test->current_test_case()); |
| 286 | 286 |
| 287 g_test_log_collector.Get().Initialize(unit_test); | 287 g_test_log_collector.Get().Initialize(unit_test); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace logging_win | 290 } // namespace logging_win |
| OLD | NEW |