diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 14:37:38 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 14:37:38 +0000 |
commit | 4b59cf24ca1128e5b3f3b4fa8b585575d44222f7 (patch) | |
tree | 063ccb2187e2285260b309e284b2f2170b0240e4 /chrome_frame | |
parent | fd7bdcc89b6483ebbfc4eaca6a7b0ba1fe1aca1b (diff) | |
download | chromium_src-4b59cf24ca1128e5b3f3b4fa8b585575d44222f7.zip chromium_src-4b59cf24ca1128e5b3f3b4fa8b585575d44222f7.tar.gz chromium_src-4b59cf24ca1128e5b3f3b4fa8b585575d44222f7.tar.bz2 |
Make running chrome process detection in ui tests more reliable.
Also drops fragile code.
TEST=Covered by ui_tests.
BUG=10840
Review URL: http://codereview.chromium.org/545006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/test/perf/chrome_frame_perftest.cc | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/chrome_frame/test/perf/chrome_frame_perftest.cc b/chrome_frame/test/perf/chrome_frame_perftest.cc index 8ac05cf..1627b13 100644 --- a/chrome_frame/test/perf/chrome_frame_perftest.cc +++ b/chrome_frame/test/perf/chrome_frame_perftest.cc @@ -530,9 +530,8 @@ class ChromeFrameMemoryTest : public ChromeFramePerfTestBase { typedef std::map<DWORD, ProcessMemoryInfo> ProcessMemoryConsumptionMap; public: - ChromeFrameMemoryTest() - : current_url_index_(0), - browser_pid_(0) {} + ChromeFrameMemoryTest() : current_url_index_(0) { + } virtual void SetUp() { // Register the Chrome Frame DLL in the build directory. @@ -613,17 +612,6 @@ class ChromeFrameMemoryTest : public ChromeFramePerfTestBase { } void InitiateNextNavigation() { - if (browser_pid_ == 0) { - FilePath profile_directory; - if (chrome::GetChromeFrameUserDataDirectory(&user_data_dir_)) { - user_data_dir_ = user_data_dir_.Append(GetHostProcessName(false)); - } - - browser_pid_ = ChromeBrowserProcessId(user_data_dir_); - } - - EXPECT_TRUE(static_cast<int>(browser_pid_) > 0); - // Get the memory consumption information for the child processes // of the chrome browser. ChromeProcessList child_processes = GetBrowserChildren(); @@ -668,9 +656,9 @@ class ChromeFrameMemoryTest : public ChromeFramePerfTestBase { } ChromeProcessList GetBrowserChildren() { - ChromeProcessList list = GetRunningChromeProcesses(user_data_dir_); + ChromeProcessList list = GetRunningChromeProcesses(browser_process_id()); ChromeProcessList::iterator browser = - std::find(list.begin(), list.end(), browser_pid_); + std::find(list.begin(), list.end(), browser_process_id()); if (browser != list.end()) { list.erase(browser); } @@ -678,8 +666,8 @@ class ChromeFrameMemoryTest : public ChromeFramePerfTestBase { } void AccountProcessMemoryUsage(DWORD process_id) { - ProcessMemoryInfo process_memory_info(process_id, - process_id == browser_pid_, this); + ProcessMemoryInfo process_memory_info( + process_id, process_id == browser_process_id(), this); ASSERT_TRUE(process_memory_info.GetMemoryConsumptionDetails()); @@ -736,9 +724,6 @@ class ChromeFrameMemoryTest : public ChromeFramePerfTestBase { // The index of the URL being tested. size_t current_url_index_; - // The chrome browser pid. - base::ProcessId browser_pid_; - // Contains the list of urls against which the tests are run. std::vector<std::string> urls_; @@ -834,10 +819,8 @@ class ChromeFrameActiveXMemoryTest : public MemoryTestBase { // This can get called multiple times if the last url results in a // redirect. if (!test_completed_) { - ASSERT_NE(browser_pid_, 0); - // Measure memory usage for the browser process. - AccountProcessMemoryUsage(browser_pid_); + AccountProcessMemoryUsage(browser_process_id()); // Measure memory usage for the current process. AccountProcessMemoryUsage(GetCurrentProcessId()); |