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

Side by Side Diff: base/process/process_metrics_unittest.cc

Issue 2735113003: Changing SpawnChild to return a struct.
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « base/memory/shared_memory_unittest.cc ('k') | base/process/process_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/process/process_metrics.h" 5 #include "base/process/process_metrics.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <sstream> 10 #include <sstream>
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 484 }
485 485
486 } // namespace 486 } // namespace
487 487
488 TEST(ProcessMetricsTest, GetOpenFdCount) { 488 TEST(ProcessMetricsTest, GetOpenFdCount) {
489 ScopedTempDir temp_dir; 489 ScopedTempDir temp_dir;
490 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 490 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
491 const FilePath temp_path = temp_dir.GetPath(); 491 const FilePath temp_path = temp_dir.GetPath();
492 CommandLine child_command_line(GetMultiProcessTestChildBaseCommandLine()); 492 CommandLine child_command_line(GetMultiProcessTestChildBaseCommandLine());
493 child_command_line.AppendSwitchPath(kTempDirFlag, temp_path); 493 child_command_line.AppendSwitchPath(kTempDirFlag, temp_path);
494 Process child = SpawnMultiProcessTestChild( 494 SpawnChildResult spawn_result = SpawnMultiProcessTestChild(
495 ChildMainString, child_command_line, LaunchOptions()); 495 ChildMainString, child_command_line, LaunchOptions());
496 Process child = std::move(spawn_result.process);
496 ASSERT_TRUE(child.IsValid()); 497 ASSERT_TRUE(child.IsValid());
497 WaitForEvent(temp_path, kSignalClosed); 498 WaitForEvent(temp_path, kSignalClosed);
498 499
499 std::unique_ptr<ProcessMetrics> metrics( 500 std::unique_ptr<ProcessMetrics> metrics(
500 ProcessMetrics::CreateProcessMetrics(child.Handle())); 501 ProcessMetrics::CreateProcessMetrics(child.Handle()));
501 EXPECT_EQ(0, metrics->GetOpenFdCount()); 502 EXPECT_EQ(0, metrics->GetOpenFdCount());
502 ASSERT_TRUE(child.Terminate(0, true)); 503 ASSERT_TRUE(child.Terminate(0, true));
503 } 504 }
504 #endif // defined(OS_LINUX) 505 #endif // defined(OS_LINUX)
505 506
506 } // namespace debug 507 } // namespace debug
507 } // namespace base 508 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_unittest.cc ('k') | base/process/process_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698