| OLD | NEW |
| 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" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 generator_.ReleaseHandlesWithoutClosing(); | 77 generator_.ReleaseHandlesWithoutClosing(); |
| 78 | 78 |
| 79 interpreted_ = ChromeWatcherCommandLine::InterpretCommandLine(cmd_line_); | 79 interpreted_ = ChromeWatcherCommandLine::InterpretCommandLine(cmd_line_); |
| 80 EXPECT_TRUE(interpreted_); | 80 EXPECT_TRUE(interpreted_); |
| 81 } | 81 } |
| 82 | 82 |
| 83 base::Process process_; | 83 base::Process process_; |
| 84 base::win::ScopedHandle event_; | 84 base::win::ScopedHandle event_; |
| 85 TestChromeWatcherCommandLineGenerator generator_; | 85 TestChromeWatcherCommandLineGenerator generator_; |
| 86 base::CommandLine cmd_line_; | 86 base::CommandLine cmd_line_; |
| 87 scoped_ptr<ChromeWatcherCommandLine> interpreted_; | 87 std::unique_ptr<ChromeWatcherCommandLine> interpreted_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // The corresponding death test fixture. | 90 // The corresponding death test fixture. |
| 91 using ChromeWatcherCommandLineDeathTest = ChromeWatcherCommandLineTest; | 91 using ChromeWatcherCommandLineDeathTest = ChromeWatcherCommandLineTest; |
| 92 | 92 |
| 93 TEST(ChromeWatcherCommandLineGeneratorTest, UseOfBadHandlesFails) { | 93 TEST(ChromeWatcherCommandLineGeneratorTest, UseOfBadHandlesFails) { |
| 94 // Handles are always machine word aligned so there is no way these are valid. | 94 // Handles are always machine word aligned so there is no way these are valid. |
| 95 HANDLE bad_handle_1 = reinterpret_cast<HANDLE>(0x01FC00B1); | 95 HANDLE bad_handle_1 = reinterpret_cast<HANDLE>(0x01FC00B1); |
| 96 HANDLE bad_handle_2 = reinterpret_cast<HANDLE>(0x01FC00B3); | 96 HANDLE bad_handle_2 = reinterpret_cast<HANDLE>(0x01FC00B3); |
| 97 | 97 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 base::win::ScopedHandle current_result; | 167 base::win::ScopedHandle current_result; |
| 168 DWORD current_thread_id_result = 0; | 168 DWORD current_thread_id_result = 0; |
| 169 base::win::ScopedHandle event_result; | 169 base::win::ScopedHandle event_result; |
| 170 ASSERT_TRUE(InterpretChromeWatcherCommandLine( | 170 ASSERT_TRUE(InterpretChromeWatcherCommandLine( |
| 171 cmd_line, ¤t_result, ¤t_thread_id_result, &event_result)); | 171 cmd_line, ¤t_result, ¤t_thread_id_result, &event_result)); |
| 172 ASSERT_EQ(current, current_result.Get()); | 172 ASSERT_EQ(current, current_result.Get()); |
| 173 ASSERT_EQ(current_thread_id, current_thread_id_result); | 173 ASSERT_EQ(current_thread_id, current_thread_id_result); |
| 174 ASSERT_EQ(event, event_result.Get()); | 174 ASSERT_EQ(event, event_result.Get()); |
| 175 } | 175 } |
| OLD | NEW |