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

Side by Side Diff: chrome/test/logging/win/mof_data_parser_unittest.cc

Issue 1548153002: Switch to standard integer types in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 unified diff | Download patch
OLDNEW
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 <stddef.h>
6 #include <stdint.h>
7
5 #include <vector> 8 #include <vector>
6 9
7 #include "base/basictypes.h" 10 #include "base/macros.h"
8 #include "chrome/test/logging/win/mof_data_parser.h" 11 #include "chrome/test/logging/win/mof_data_parser.h"
9 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
10 13
11 // A test fixture for Mof parser tests. 14 // A test fixture for Mof parser tests.
12 class MofDataParserTest : public ::testing::Test { 15 class MofDataParserTest : public ::testing::Test {
13 protected: 16 protected:
14 EVENT_TRACE* MakeEventWithDataOfSize(size_t size); 17 EVENT_TRACE* MakeEventWithDataOfSize(size_t size);
15 template<typename T> EVENT_TRACE* MakeEventWithBlittedValue(T value) { 18 template<typename T> EVENT_TRACE* MakeEventWithBlittedValue(T value) {
16 EVENT_TRACE* event = MakeEventWithDataOfSize(sizeof(value)); 19 EVENT_TRACE* event = MakeEventWithDataOfSize(sizeof(value));
17 *reinterpret_cast<T*>(event->MofData) = value; 20 *reinterpret_cast<T*>(event->MofData) = value;
18 return event; 21 return event;
19 } 22 }
20 EVENT_TRACE* MakeEventWithDWORD(DWORD value); 23 EVENT_TRACE* MakeEventWithDWORD(DWORD value);
21 EVENT_TRACE* MakeEventWithPointerArray(const void* const* pointers, 24 EVENT_TRACE* MakeEventWithPointerArray(const void* const* pointers,
22 DWORD size); 25 DWORD size);
23 EVENT_TRACE* MakeEventWithString(const char* a_string, size_t length); 26 EVENT_TRACE* MakeEventWithString(const char* a_string, size_t length);
24 27
25 std::vector<uint8> buffer_; 28 std::vector<uint8_t> buffer_;
26 }; 29 };
27 30
28 EVENT_TRACE* MofDataParserTest::MakeEventWithDataOfSize(size_t size) { 31 EVENT_TRACE* MofDataParserTest::MakeEventWithDataOfSize(size_t size) {
29 buffer_.assign(sizeof(EVENT_TRACE) + size, 0); 32 buffer_.assign(sizeof(EVENT_TRACE) + size, 0);
30 EVENT_TRACE* event = reinterpret_cast<EVENT_TRACE*>(&buffer_[0]); 33 EVENT_TRACE* event = reinterpret_cast<EVENT_TRACE*>(&buffer_[0]);
31 event->MofLength = size; 34 event->MofLength = size;
32 event->MofData = &buffer_[sizeof(EVENT_TRACE)]; 35 event->MofData = &buffer_[sizeof(EVENT_TRACE)];
33 return event; 36 return event;
34 } 37 }
35 38
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // Try a string that isn't terminated. 185 // Try a string that isn't terminated.
183 event = MakeEventWithString(a_string, arraysize(a_string) - 1); 186 event = MakeEventWithString(a_string, arraysize(a_string) - 1);
184 { 187 {
185 base::StringPiece value; 188 base::StringPiece value;
186 logging_win::MofDataParser parser(event); 189 logging_win::MofDataParser parser(event);
187 EXPECT_FALSE(parser.empty()); 190 EXPECT_FALSE(parser.empty());
188 EXPECT_FALSE(parser.ReadString(&value)); 191 EXPECT_FALSE(parser.ReadString(&value));
189 EXPECT_FALSE(parser.empty()); 192 EXPECT_FALSE(parser.empty());
190 } 193 }
191 } 194 }
OLDNEW
« no previous file with comments | « chrome/test/logging/win/mof_data_parser.cc ('k') | chrome/test/logging/win/test_log_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698