| 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 // The test scrubber uses a Google Test event listener to trigger scrubs. | 5 // The test scrubber uses a Google Test event listener to trigger scrubs. |
| 6 // Scrubs are performed at the start of the test program and at the conclusion | 6 // Scrubs are performed at the start of the test program and at the conclusion |
| 7 // of each test. | 7 // of each test. |
| 8 | 8 |
| 9 #include "chrome_frame/test/test_scrubber.h" | 9 #include "chrome_frame/test/test_scrubber.h" |
| 10 | 10 |
| 11 #include <windows.h> | 11 #include <windows.h> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/string16.h" | 19 #include "base/string16.h" |
| 20 #include "base/test/test_process_killer_win.h" |
| 20 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 21 #include "base/win/registry.h" | 22 #include "base/win/registry.h" |
| 22 #include "base/win/scoped_handle.h" | 23 #include "base/win/scoped_handle.h" |
| 23 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| 24 #include "chrome_frame/test/chrome_frame_test_utils.h" | 25 #include "chrome_frame/test/chrome_frame_test_utils.h" |
| 25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 28 |
| 28 namespace chrome_frame_test { | 29 namespace chrome_frame_test { |
| 29 | 30 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 96 |
| 96 void TestScrubber::CleanUpFromTestRun() { | 97 void TestScrubber::CleanUpFromTestRun() { |
| 97 // Kill all iexplore.exe and ieuser.exe processes. | 98 // Kill all iexplore.exe and ieuser.exe processes. |
| 98 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); | 99 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); |
| 99 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); | 100 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); |
| 100 | 101 |
| 101 // Kill all chrome_launcher processes trying to launch Chrome. | 102 // Kill all chrome_launcher processes trying to launch Chrome. |
| 102 base::KillProcesses(chrome_frame_test::kChromeLauncher, 0, NULL); | 103 base::KillProcesses(chrome_frame_test::kChromeLauncher, 0, NULL); |
| 103 | 104 |
| 104 // Kill all chrome.exe processes with --chrome-frame. | 105 // Kill all chrome.exe processes with --chrome-frame. |
| 105 KillAllNamedProcessesWithArgument( | 106 base::KillAllNamedProcessesWithArgument( |
| 106 chrome::kBrowserProcessExecutableName, | 107 chrome::kBrowserProcessExecutableName, |
| 107 ASCIIToWide(switches::kChromeFrame)); | 108 ASCIIToWide(switches::kChromeFrame)); |
| 108 | 109 |
| 109 // Delete the user data directory. | 110 // Delete the user data directory. |
| 110 base::FilePath data_directory(data_directory_override_.empty() ? | 111 base::FilePath data_directory(data_directory_override_.empty() ? |
| 111 default_data_directory_ : | 112 default_data_directory_ : |
| 112 data_directory_override_); | 113 data_directory_override_); |
| 113 | 114 |
| 114 VLOG_IF(1, file_util::PathExists(data_directory)) | 115 VLOG_IF(1, file_util::PathExists(data_directory)) |
| 115 << __FUNCTION__ << " deleting user data directory " | 116 << __FUNCTION__ << " deleting user data directory " |
| (...skipping 21 matching lines...) Expand all Loading... |
| 137 | 138 |
| 138 void OverrideDataDirectoryForThisTest( | 139 void OverrideDataDirectoryForThisTest( |
| 139 const base::StringPiece16& user_data_dir) { | 140 const base::StringPiece16& user_data_dir) { |
| 140 // Must be called within the context of a test. | 141 // Must be called within the context of a test. |
| 141 DCHECK(testing::UnitTest::GetInstance()->current_test_info()); | 142 DCHECK(testing::UnitTest::GetInstance()->current_test_info()); |
| 142 | 143 |
| 143 g_scrubber.Get().set_data_directory_override(user_data_dir); | 144 g_scrubber.Get().set_data_directory_override(user_data_dir); |
| 144 } | 145 } |
| 145 | 146 |
| 146 } // namespace chrome_frame_test | 147 } // namespace chrome_frame_test |
| OLD | NEW |