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

Side by Side Diff: util/win/process_info_test.cc

Issue 1428753009: win: crashpad_util_test ProcessInfo.Handles doesn't work with CONOUT$ (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 TEST(ProcessInfo, Handles) { 531 TEST(ProcessInfo, Handles) {
532 ScopedTempDir temp_dir; 532 ScopedTempDir temp_dir;
533 533
534 ScopedFileHandle file(LoggingOpenFileForWrite( 534 ScopedFileHandle file(LoggingOpenFileForWrite(
535 temp_dir.path().Append(FILE_PATH_LITERAL("test_file")), 535 temp_dir.path().Append(FILE_PATH_LITERAL("test_file")),
536 FileWriteMode::kTruncateOrCreate, 536 FileWriteMode::kTruncateOrCreate,
537 FilePermissions::kWorldReadable)); 537 FilePermissions::kWorldReadable));
538 ASSERT_TRUE(file.is_valid()); 538 ASSERT_TRUE(file.is_valid());
539 539
540 SECURITY_ATTRIBUTES security_attributes = {0}; 540 SECURITY_ATTRIBUTES security_attributes = {0};
541 security_attributes.nLength = sizeof(security_attributes);
Mark Mentovai 2015/11/05 19:42:01 I originally thought that this would be the proble
541 security_attributes.bInheritHandle = true; 542 security_attributes.bInheritHandle = true;
542 ScopedFileHandle inherited_file(CreateFile(L"CONOUT$", 543 ScopedFileHandle inherited_file(CreateFile(
543 GENERIC_WRITE, 544 temp_dir.path().Append(FILE_PATH_LITERAL("inheritable")).value().c_str(),
544 0, 545 GENERIC_WRITE,
545 &security_attributes, 546 0,
546 OPEN_EXISTING, 547 &security_attributes,
547 FILE_ATTRIBUTE_NORMAL, 548 CREATE_NEW,
548 nullptr)); 549 FILE_ATTRIBUTE_NORMAL,
550 nullptr));
549 ASSERT_TRUE(inherited_file.is_valid()); 551 ASSERT_TRUE(inherited_file.is_valid());
550 552
551 HKEY key; 553 HKEY key;
552 ASSERT_EQ(ERROR_SUCCESS, 554 ASSERT_EQ(ERROR_SUCCESS,
553 RegOpenKeyEx( 555 RegOpenKeyEx(
554 HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft", 0, KEY_READ, &key)); 556 HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft", 0, KEY_READ, &key));
555 ScopedRegistryKey scoped_key(key); 557 ScopedRegistryKey scoped_key(key);
556 ASSERT_TRUE(scoped_key.is_valid()); 558 ASSERT_TRUE(scoped_key.is_valid());
557 559
558 std::wstring mapping_name = 560 std::wstring mapping_name =
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 EXPECT_TRUE( 639 EXPECT_TRUE(
638 info.LoggingRangeIsFullyReadable(CheckedRange<WinVMAddress, WinVMSize>( 640 info.LoggingRangeIsFullyReadable(CheckedRange<WinVMAddress, WinVMSize>(
639 reinterpret_cast<WinVMAddress>(safe_memory.get()), kAllocationSize))); 641 reinterpret_cast<WinVMAddress>(safe_memory.get()), kAllocationSize)));
640 EXPECT_FALSE(info.LoggingRangeIsFullyReadable( 642 EXPECT_FALSE(info.LoggingRangeIsFullyReadable(
641 CheckedRange<WinVMAddress, WinVMSize>(0, 1024))); 643 CheckedRange<WinVMAddress, WinVMSize>(0, 1024)));
642 } 644 }
643 645
644 } // namespace 646 } // namespace
645 } // namespace test 647 } // namespace test
646 } // namespace crashpad 648 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698