| OLD | NEW |
| 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 "chrome/installer/setup/setup_util_unittest.h" | 5 #include "chrome/installer/setup/setup_util_unittest.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 ScopedPriorityClass::~ScopedPriorityClass() { | 223 ScopedPriorityClass::~ScopedPriorityClass() { |
| 224 BOOL result = ::SetPriorityClass(::GetCurrentProcess(), | 224 BOOL result = ::SetPriorityClass(::GetCurrentProcess(), |
| 225 original_priority_class_); | 225 original_priority_class_); |
| 226 EXPECT_NE(FALSE, result); | 226 EXPECT_NE(FALSE, result); |
| 227 } | 227 } |
| 228 | 228 |
| 229 PriorityClassChangeResult RelaunchAndDoProcessPriorityAdjustment() { | 229 PriorityClassChangeResult RelaunchAndDoProcessPriorityAdjustment() { |
| 230 CommandLine cmd_line(*CommandLine::ForCurrentProcess()); | 230 CommandLine cmd_line(*CommandLine::ForCurrentProcess()); |
| 231 cmd_line.AppendSwitch(kAdjustProcessPriority); | 231 cmd_line.AppendSwitch(kAdjustProcessPriority); |
| 232 base::ProcessHandle process_handle = NULL; | 232 base::Process process = base::LaunchProcess(cmd_line, base::LaunchOptions()); |
| 233 int exit_code = 0; | 233 int exit_code = 0; |
| 234 if (!base::LaunchProcess(cmd_line, base::LaunchOptions(), | 234 if (!process.IsValid()) { |
| 235 &process_handle)) { | |
| 236 ADD_FAILURE() << " to launch subprocess."; | 235 ADD_FAILURE() << " to launch subprocess."; |
| 237 } else if (!base::WaitForExitCode(process_handle, &exit_code)) { | 236 } else if (!process.WaitForExit(&exit_code)) { |
| 238 ADD_FAILURE() << " to wait for subprocess to exit."; | 237 ADD_FAILURE() << " to wait for subprocess to exit."; |
| 239 } else { | 238 } else { |
| 240 return static_cast<PriorityClassChangeResult>(exit_code); | 239 return static_cast<PriorityClassChangeResult>(exit_code); |
| 241 } | 240 } |
| 242 return PCCR_UNKNOWN; | 241 return PCCR_UNKNOWN; |
| 243 } | 242 } |
| 244 | 243 |
| 245 } // namespace | 244 } // namespace |
| 246 | 245 |
| 247 // Launching a subprocess at normal priority class is a noop. | 246 // Launching a subprocess at normal priority class is a noop. |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 } | 487 } |
| 489 | 488 |
| 490 TEST(SetupUtilTest, ContainsUnsupportedSwitch) { | 489 TEST(SetupUtilTest, ContainsUnsupportedSwitch) { |
| 491 EXPECT_FALSE(installer::ContainsUnsupportedSwitch( | 490 EXPECT_FALSE(installer::ContainsUnsupportedSwitch( |
| 492 CommandLine::FromString(L"foo.exe"))); | 491 CommandLine::FromString(L"foo.exe"))); |
| 493 EXPECT_FALSE(installer::ContainsUnsupportedSwitch( | 492 EXPECT_FALSE(installer::ContainsUnsupportedSwitch( |
| 494 CommandLine::FromString(L"foo.exe --multi-install --chrome"))); | 493 CommandLine::FromString(L"foo.exe --multi-install --chrome"))); |
| 495 EXPECT_TRUE(installer::ContainsUnsupportedSwitch( | 494 EXPECT_TRUE(installer::ContainsUnsupportedSwitch( |
| 496 CommandLine::FromString(L"foo.exe --chrome-frame"))); | 495 CommandLine::FromString(L"foo.exe --chrome-frame"))); |
| 497 } | 496 } |
| OLD | NEW |