From 6ce9560db08042fe9f40e060662ab456ce634c0e Mon Sep 17 00:00:00 2001 From: "phajdan.jr@chromium.org" Date: Mon, 30 Aug 2010 22:59:43 +0000 Subject: GTTF: Uncrashy memory_test. It's still going to fail randomly, but at least shouldn't crrrrrash. TBR=huanr BUG=53882 TEST=memory_test Review URL: http://codereview.chromium.org/3248005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57926 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/memory_test/memory_test.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'chrome/test') diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index 5024c9c..6d78d5e 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -137,8 +137,10 @@ class MemoryTest : public UIPerfTest { // Cycle through the URLs. scoped_refptr window(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(window.get()); int active_window = 0; // The index of the window we are currently using. scoped_refptr tab(window->GetActiveTab()); + ASSERT_TRUE(tab.get()); int expected_tab_count = 1; for (unsigned counter = 0; counter < urls_length; ++counter) { std::string url = urls[counter]; @@ -160,12 +162,13 @@ class MemoryTest : public UIPerfTest { expected_tab_count++; WaitUntilTabCount(expected_tab_count); tab = window->GetActiveTab(); - EXPECT_NE(tab, static_cast(NULL)); + ASSERT_TRUE(tab.get()); continue; } int tab_index = counter % num_target_tabs; // A pseudo-random tab. tab = window->GetTab(tab_index); + ASSERT_TRUE(tab.get()); } if (url == "") { // Special command to select the next tab. @@ -174,7 +177,7 @@ class MemoryTest : public UIPerfTest { EXPECT_TRUE(window->GetTabCount(&tab_count)); tab_index = (tab_index + 1) % tab_count; tab = window->GetTab(tab_index); - EXPECT_NE(tab, static_cast(NULL)); + ASSERT_TRUE(tab.get()); continue; } @@ -198,8 +201,9 @@ class MemoryTest : public UIPerfTest { active_window = window_count - 1; window = automation()->GetBrowserWindow(active_window); + ASSERT_TRUE(window.get()); tab = window->GetActiveTab(); - EXPECT_NE(tab, static_cast(NULL)); + ASSERT_TRUE(tab.get()); continue; } @@ -208,8 +212,9 @@ class MemoryTest : public UIPerfTest { EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); active_window = (active_window + 1) % window_count; window = automation()->GetBrowserWindow(active_window); + ASSERT_TRUE(window.get()); tab = window->GetActiveTab(); - EXPECT_NE(tab, static_cast(NULL)); + ASSERT_TRUE(tab.get()); continue; } -- cgit v1.1