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

Side by Side Diff: chrome/app/chrome_watcher_command_line_unittest_win.cc

Issue 868543002: Move OpenProcessHandle to Process::Open. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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/process/process_win.cc ('k') | chrome/browser/chromeos/policy/device_status_collector.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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 "chrome/app/chrome_watcher_command_line_win.h" 5 #include "chrome/app/chrome_watcher_command_line_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/process/process_handle.h" 11 #include "base/process/process.h"
12 #include "base/win/scoped_handle.h" 12 #include "base/win/scoped_handle.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 TEST(ChromeWatcherCommandLineTest, BasicTest) { 15 TEST(ChromeWatcherCommandLineTest, BasicTest) {
16 // Ownership of these handles is passed to the ScopedHandles below via 16 base::Process current = base::Process::Open(base::GetCurrentProcId());
17 // InterpretChromeWatcherCommandLine(). 17 ASSERT_TRUE(current.IsValid());
18 base::ProcessHandle current = nullptr;
19 ASSERT_TRUE(base::OpenProcessHandle(base::GetCurrentProcId(), &current));
20 HANDLE event = ::CreateEvent(nullptr, FALSE, FALSE, nullptr); 18 HANDLE event = ::CreateEvent(nullptr, FALSE, FALSE, nullptr);
21 19
22 base::CommandLine cmd_line = GenerateChromeWatcherCommandLine( 20 base::CommandLine cmd_line = GenerateChromeWatcherCommandLine(
23 base::FilePath(L"example.exe"), current, event); 21 base::FilePath(L"example.exe"), current.Handle(), event);
24 22
25 base::win::ScopedHandle current_result; 23 base::win::ScopedHandle current_result;
26 base::win::ScopedHandle event_result; 24 base::win::ScopedHandle event_result;
27 ASSERT_TRUE(InterpretChromeWatcherCommandLine(cmd_line, &current_result, 25 ASSERT_TRUE(InterpretChromeWatcherCommandLine(cmd_line, &current_result,
28 &event_result)); 26 &event_result));
29 ASSERT_EQ(current, current_result.Get()); 27 ASSERT_EQ(current.Handle(), current_result.Get());
30 ASSERT_EQ(event, event_result.Get()); 28 ASSERT_EQ(event, event_result.Get());
31 } 29 }
OLDNEW
« no previous file with comments | « base/process/process_win.cc ('k') | chrome/browser/chromeos/policy/device_status_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698