diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-12 21:42:11 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-12 21:42:11 +0000 |
commit | 9bcc1b016b1e71de11787d94440dd5ca5e77ca77 (patch) | |
tree | 78179da85eaca00bc2b0592aa59c4925d65c33b9 /chrome/test/logging/win/mof_data_parser.cc | |
parent | 055ea435e935d8b2dec637340f3074750aa07fd7 (diff) | |
download | chromium_src-9bcc1b016b1e71de11787d94440dd5ca5e77ca77.zip chromium_src-9bcc1b016b1e71de11787d94440dd5ca5e77ca77.tar.gz chromium_src-9bcc1b016b1e71de11787d94440dd5ca5e77ca77.tar.bz2 |
New test infrastructure for producing verbose logs in failing tests.
This infrastructure allows Google Test-based tests to opt-in to some magic that results in extremely verbose logs appearing in test output for only those tests that fail. This includes all LOG() messages generated by chrome.exe, npchrome_frame.exe, and the test executable itself, as well as all TRACE_EVENT_*_ETW events. The interesting entrypoints are in test_log_collector_win.h, file_logger_win.h, and log_file_printer_win.h.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/9584017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126240 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/logging/win/mof_data_parser.cc')
-rw-r--r-- | chrome/test/logging/win/mof_data_parser.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/test/logging/win/mof_data_parser.cc b/chrome/test/logging/win/mof_data_parser.cc new file mode 100644 index 0000000..027cf1f --- /dev/null +++ b/chrome/test/logging/win/mof_data_parser.cc @@ -0,0 +1,29 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/test/logging/win/mof_data_parser.h" + +namespace logging_win { + +MofDataParser::MofDataParser(const EVENT_TRACE* event) + : scan_(reinterpret_cast<const uint8*>(event->MofData)), + length_(event->MofLength) { +} + +bool MofDataParser::ReadString(base::StringPiece* value) { + const uint8* str_scan = scan_; + const uint8* const str_end = str_scan + length_; + while (str_scan < str_end && *str_scan != 0) + ++str_scan; + if (str_scan == str_end) + return false; + size_t string_length = str_scan - scan_; + bool has_trailing_newline = (string_length > 0 && str_scan[-1] == '\n'); + value->set(reinterpret_cast<const char*>(scan_), + has_trailing_newline ? string_length - 1 : string_length); + Advance(string_length + 1); + return true; +} + +} // namespace logging_win |