15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The test log collector uses Event Tracing for Windows to collect all LOG() 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// events at all levels (including all VLOG levels) from Chrome, Chrome Frame, 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// and the test executable itself for each test into a temporary log file. At 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the conclusion of each test, the contents of the log file are regurgitated to 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// stderr iff the test failed. In any case, the log file is promptly deleted. 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Test executables that wish to benefit from the collector's features (to 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// produce verbose logs on test failure to aid in diagnosing flaky and/or 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// failing tests, for example) must install the collector via 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// |InstallTestLogCollector| before running tests (via RUN_ALL_TESTS(), 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// TestSuite::Run(), etc). 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_TEST_LOGGING_WIN_TEST_LOG_COLLECTOR_H_ 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_TEST_LOGGING_WIN_TEST_LOG_COLLECTOR_H_ 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace testing { 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class UnitTest; 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace logging_win { 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Installs the test log collector into |unit_test| for its lifetime. 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// (Use testing::UnitTest::GetInstance() to get the process-wide unit test 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// instance.) 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void InstallTestLogCollector(testing::UnitTest* unit_test); 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace logging_win 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_TEST_LOGGING_WIN_TEST_LOG_COLLECTOR_H_ 34