diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 03:25:15 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 03:25:15 +0000 |
commit | 176aa48371da91eb98d675d87b4e70c7b26d696f (patch) | |
tree | 4c972de6ecd5a54650ab1dc7d421187f5d25834f /chrome/test | |
parent | 9a3f0ac2899139ace97e399015259d028b4d5704 (diff) | |
download | chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.zip chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.gz chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.bz2 |
Add Terminate() to the Process object, have RenderProcessHost use this to avoid some more Windows specific code.
Move Process and SharedMemory into the base namespace (most changes).
Review URL: http://codereview.chromium.org/10895
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/memory_test/memory_test.cc | 8 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/chrome_mini_installer.cc | 26 | ||||
-rw-r--r-- | chrome/test/page_cycler/page_cycler_test.cc | 8 | ||||
-rw-r--r-- | chrome/test/perf/mem_usage.cc | 2 | ||||
-rw-r--r-- | chrome/test/perf/perftests.cc | 2 | ||||
-rw-r--r-- | chrome/test/reliability/run_all_unittests.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/run_all_unittests.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 23 | ||||
-rw-r--r-- | chrome/test/unit/run_all_unittests.cc | 2 |
9 files changed, 37 insertions, 38 deletions
diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index d31c1e5..fc68ede 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -266,7 +266,7 @@ class MemoryTest : public UITest { void PrintIOPerfInfo(const wchar_t* test_name) { printf("\n"); BrowserProcessFilter chrome_filter(user_data_dir_); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); @@ -281,10 +281,10 @@ class MemoryTest : public UITest { continue; } - scoped_ptr<process_util::ProcessMetrics> process_metrics; + scoped_ptr<base::ProcessMetrics> process_metrics; IO_COUNTERS io_counters; process_metrics.reset( - process_util::ProcessMetrics::CreateProcessMetrics(process_handle)); + base::ProcessMetrics::CreateProcessMetrics(process_handle)); ZeroMemory(&io_counters, sizeof(io_counters)); if (process_metrics.get()->GetIOCounters(&io_counters)) { @@ -318,7 +318,7 @@ class MemoryTest : public UITest { void PrintMemoryUsageInfo(const wchar_t* test_name) { printf("\n"); BrowserProcessFilter chrome_filter(user_data_dir_); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc index d4f0f11..d56ec00 100644 --- a/chrome/test/mini_installer_test/chrome_mini_installer.cc +++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc @@ -113,8 +113,8 @@ void ChromeMiniInstaller::UnInstall() { ASSERT_TRUE(file_util::PathExists(uninstall_path)); printf("\nUninstalling Chrome...\n"); - process_util::LaunchApp(L"\"" + uninstall_path + L"\"" + L" -uninstall", - false, false, NULL); + base::LaunchApp(L"\"" + uninstall_path + L"\"" + L" -uninstall", + false, false, NULL); printf("\nLaunched setup.exe -uninstall....\n"); ASSERT_TRUE(CloseWindow(mini_installer_constants::kChromeBuildType, WM_COMMAND)); @@ -124,8 +124,8 @@ void ChromeMiniInstaller::UnInstall() { DeleteAppFolder(); FindChromeShortcut(); CloseProcesses(mini_installer_constants::kIEExecutable); - ASSERT_EQ(0, process_util::GetProcessCount( - mini_installer_constants::kIEExecutable, NULL)); + ASSERT_EQ(0, + base::GetProcessCount(mini_installer_constants::kIEExecutable, NULL)); } // Takes care of Chrome uninstall dialog. @@ -154,13 +154,13 @@ void ChromeMiniInstaller::CloseChromeBrowser(LPCWSTR window_name) { // Checks for all requested running processes and kills them. void ChromeMiniInstaller::CloseProcesses(const std::wstring& executable_name) { int timer = 0; - while ((process_util::GetProcessCount(executable_name, NULL) > 0) && + while ((base::GetProcessCount(executable_name, NULL) > 0) && (timer < 20000)) { - process_util::KillProcesses(executable_name, 1, NULL); + base::KillProcesses(executable_name, 1, NULL); Sleep(200); timer = timer + 200; } - ASSERT_EQ(0, process_util::GetProcessCount(executable_name, NULL)); + ASSERT_EQ(0, base::GetProcessCount(executable_name, NULL)); } // Checks for Chrome registry keys. @@ -256,7 +256,7 @@ void ChromeMiniInstaller::LaunchExe(std::wstring path, const wchar_t process_name[]) { printf("\nBuild to be installed is: %ls\n", path.c_str()); ASSERT_TRUE(file_util::PathExists(path)); - process_util::LaunchApp(L"\"" + path + L"\"", false, false, NULL); + base::LaunchApp(L"\"" + path + L"\"", false, false, NULL); printf("Waiting while this process is running %ls ....", process_name); WaitUntilProcessStartsRunning(process_name); WaitUntilProcessStopsRunning(process_name); @@ -268,7 +268,7 @@ void ChromeMiniInstaller::VerifyChromeLaunch() { ASSERT_TRUE(PathService::Get(base::DIR_LOCAL_APP_DATA, &path)); file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); file_util::AppendToPath(&path, installer_util::kChromeExe); - process_util::LaunchApp(L"\"" + path + L"\"", false, false, NULL); + base::LaunchApp(L"\"" + path + L"\"", false, false, NULL); WaitUntilProcessStartsRunning(installer_util::kChromeExe); Sleep(1200); } @@ -297,12 +297,12 @@ bool ChromeMiniInstaller::VerifyOverInstall( void ChromeMiniInstaller::WaitUntilProcessStartsRunning( const wchar_t process_name[]) { int timer = 0; - while ((process_util::GetProcessCount(process_name, NULL) == 0) && + while ((base::GetProcessCount(process_name, NULL) == 0) && (timer < 60000)) { Sleep(200); timer = timer + 200; } - ASSERT_NE(0, process_util::GetProcessCount(process_name, NULL)); + ASSERT_NE(0, base::GetProcessCount(process_name, NULL)); } // Waits until the process stops running. @@ -310,11 +310,11 @@ void ChromeMiniInstaller::WaitUntilProcessStopsRunning( const wchar_t process_name[]) { int timer = 0; printf("\nWaiting for this process to end... %ls\n", process_name); - while ((process_util::GetProcessCount(process_name, NULL) > 0) && + while ((base::GetProcessCount(process_name, NULL) > 0) && (timer < 60000)) { Sleep(200); timer = timer + 200; } - ASSERT_EQ(0, process_util::GetProcessCount(process_name, NULL)); + ASSERT_EQ(0, base::GetProcessCount(process_name, NULL)); } diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index aab3eed..59d0ce8 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -90,7 +90,7 @@ class PageCyclerTest : public UITest { void PrintIOPerfInfo(const wchar_t* test_name) { BrowserProcessFilter chrome_filter(L""); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); @@ -101,10 +101,10 @@ class PageCyclerTest : public UITest { false, pid); - scoped_ptr<process_util::ProcessMetrics> process_metrics; + scoped_ptr<base::ProcessMetrics> process_metrics; IO_COUNTERS io_counters; process_metrics.reset( - process_util::ProcessMetrics::CreateProcessMetrics(process_handle)); + base::ProcessMetrics::CreateProcessMetrics(process_handle)); ZeroMemory(&io_counters, sizeof(io_counters)); if (process_metrics.get()->GetIOCounters(&io_counters)) { @@ -160,7 +160,7 @@ class PageCyclerTest : public UITest { void PrintMemoryUsageInfo(const wchar_t* test_name) { BrowserProcessFilter chrome_filter(L""); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); diff --git a/chrome/test/perf/mem_usage.cc b/chrome/test/perf/mem_usage.cc index c1d7941..fdfa435 100644 --- a/chrome/test/perf/mem_usage.cc +++ b/chrome/test/perf/mem_usage.cc @@ -81,7 +81,7 @@ size_t GetSystemCommitCharge() { void PrintChromeMemoryUsageInfo() { printf("\n"); BrowserProcessFilter chrome_filter(L""); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); const PROCESSENTRY32* chrome_entry; diff --git a/chrome/test/perf/perftests.cc b/chrome/test/perf/perftests.cc index 2b1e4e5..3e67a6b 100644 --- a/chrome/test/perf/perftests.cc +++ b/chrome/test/perf/perftests.cc @@ -11,7 +11,7 @@ // TODO(darin): share code with base/run_all_perftests.cc int main(int argc, char **argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); chrome::RegisterPathProvider(); MessageLoop main_message_loop; diff --git a/chrome/test/reliability/run_all_unittests.cc b/chrome/test/reliability/run_all_unittests.cc index bb045ca..1f7b2a3 100644 --- a/chrome/test/reliability/run_all_unittests.cc +++ b/chrome/test/reliability/run_all_unittests.cc @@ -7,7 +7,7 @@ #include "chrome/test/reliability/reliability_test_suite.h" int main(int argc, char **argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); return ReliabilityTestSuite(argc, argv).Run(); } diff --git a/chrome/test/ui/run_all_unittests.cc b/chrome/test/ui/run_all_unittests.cc index 4400f9b..1670f1c 100644 --- a/chrome/test/ui/run_all_unittests.cc +++ b/chrome/test/ui/run_all_unittests.cc @@ -8,7 +8,7 @@ #include "chrome/test/ui/ui_test_suite.h" int main(int argc, char **argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); PlatformThread::SetName("Tests_Main"); return UITestSuite(argc, argv).Run(); } diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index f4371d2..41b1325 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -239,12 +239,11 @@ void UITest::LaunchBrowser(const std::wstring& arguments, bool clear_profile) { browser_launch_time_ = TimeTicks::Now(); - bool started = process_util::LaunchApp( - command_line, - false, // Don't wait for process object (doesn't work for - // us) - !show_window_, - &process_); + bool started = base::LaunchApp(command_line, + false, // Don't wait for process object + // (doesn't work for us) + !show_window_, + &process_); ASSERT_EQ(started, true); if (use_existing_browser_) { @@ -253,7 +252,7 @@ void UITest::LaunchBrowser(const std::wstring& arguments, bool clear_profile) { user_data_dir_.c_str()); GetWindowThreadProcessId(hwnd, &pid); // This mode doesn't work if we wound up launching a new browser ourselves. - ASSERT_NE(pid, process_util::GetProcId(process_)); + ASSERT_NE(pid, base::GetProcId(process_)); CloseHandle(process_); process_ = OpenProcess(SYNCHRONIZE, false, pid); } @@ -317,9 +316,9 @@ void UITest::CleanupAppProcesses() { // Make sure that no instances of the browser remain. const int kExitTimeoutMs = 5000; const int kExitCode = 1; - process_util::CleanupProcesses( - chrome::kBrowserProcessExecutableName, kExitTimeoutMs, kExitCode, - &filter); + base::CleanupProcesses( + chrome::kBrowserProcessExecutableName, kExitTimeoutMs, kExitCode, + &filter); // Suppress spammy failures that seem to be occurring when running // the UI tests in single-process mode. @@ -442,8 +441,8 @@ bool UITest::CrashAwareSleep(int time_out_ms) { /*static*/ int UITest::GetBrowserProcessCount() { BrowserProcessFilter filter(L""); - return process_util::GetProcessCount(chrome::kBrowserProcessExecutableName, - &filter); + return base::GetProcessCount(chrome::kBrowserProcessExecutableName, + &filter); } static DictionaryValue* LoadDictionaryValueFromPath(const std::wstring& path) { diff --git a/chrome/test/unit/run_all_unittests.cc b/chrome/test/unit/run_all_unittests.cc index 97d6719..4d16777 100644 --- a/chrome/test/unit/run_all_unittests.cc +++ b/chrome/test/unit/run_all_unittests.cc @@ -13,7 +13,7 @@ #endif int main(int argc, char **argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); #if defined(OS_WIN) // TODO(port): This is not Windows-specific, but needs to be ported. return ChromeTestSuite(argc, argv).Run(); |