Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: chrome/test/base/mof_data_parser_win.cc

Issue 9584017: New test infrastructure for producing verbose logs in failing tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops, forgot to add test Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/base/mof_data_parser_win.cc
diff --git a/chrome/test/base/mof_data_parser_win.cc b/chrome/test/base/mof_data_parser_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..55911375a81d4e7c43ac5b5503c9cacd66cc5b70
--- /dev/null
+++ b/chrome/test/base/mof_data_parser_win.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/base/mof_data_parser_win.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

Powered by Google App Engine
This is Rietveld 408576698