diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 22:05:44 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 22:05:44 +0000 |
commit | 4327e9a7b0a8d8da2e27122535ca9ff242d53d68 (patch) | |
tree | deec43ec957e1d367f3becf4fd63c525092a986a | |
parent | 95086e8626fe0b3e1a28bdd90b5d04e0e393e69e (diff) | |
download | chromium_src-4327e9a7b0a8d8da2e27122535ca9ff242d53d68.zip chromium_src-4327e9a7b0a8d8da2e27122535ca9ff242d53d68.tar.gz chromium_src-4327e9a7b0a8d8da2e27122535ca9ff242d53d68.tar.bz2 |
Latest attempt at enabling task manager tests and not having them leak or crash!
Make Task Manager Table view a scoped_ptr so it and its columns are deleted regardless of whether or not the HWND has been constructed.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/119208
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17677 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/task_manager.h | 4 | ||||
-rw-r--r-- | chrome/browser/task_manager_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/task_manager_win.cc | 12 |
3 files changed, 10 insertions, 12 deletions
diff --git a/chrome/browser/task_manager.h b/chrome/browser/task_manager.h index 1d2c311..c0eaa8b 100644 --- a/chrome/browser/task_manager.h +++ b/chrome/browser/task_manager.h @@ -121,8 +121,8 @@ class TaskManager { void OnWindowClosed(); private: - FRIEND_TEST(TaskManagerTest, DISABLED_Basic); - FRIEND_TEST(TaskManagerTest, DISABLED_Resources); + FRIEND_TEST(TaskManagerTest, Basic); + FRIEND_TEST(TaskManagerTest, Resources); // Obtain an instance via GetInstance(). TaskManager(); diff --git a/chrome/browser/task_manager_unittest.cc b/chrome/browser/task_manager_unittest.cc index 1e79534..70bb710 100644 --- a/chrome/browser/task_manager_unittest.cc +++ b/chrome/browser/task_manager_unittest.cc @@ -30,16 +30,14 @@ class TestResource : public TaskManager::Resource { class TaskManagerTest : public testing::Test { }; -TEST_F(TaskManagerTest, DISABLED_Basic) { +TEST_F(TaskManagerTest, Basic) { TaskManager task_manager; TaskManagerModel* model = task_manager.model_; - TaskManager::Open(); EXPECT_FALSE(task_manager.BrowserProcessIsSelected()); EXPECT_EQ(0, model->ResourceCount()); - TaskManager::Close(); } -TEST_F(TaskManagerTest, DISABLED_Resources) { +TEST_F(TaskManagerTest, Resources) { TaskManager task_manager; TaskManagerModel* model = task_manager.model_; diff --git a/chrome/browser/task_manager_win.cc b/chrome/browser/task_manager_win.cc index e88024d..166169d 100644 --- a/chrome/browser/task_manager_win.cc +++ b/chrome/browser/task_manager_win.cc @@ -235,7 +235,7 @@ class TaskManagerViewImpl : public TaskManagerView, scoped_ptr<views::NativeButton> kill_button_; scoped_ptr<views::Link> about_memory_link_; - views::GroupTableView* tab_table_; + scoped_ptr<views::GroupTableView> tab_table_; TaskManager* task_manager_; @@ -293,9 +293,10 @@ void TaskManagerViewImpl::Init() { views::TableColumn::RIGHT, -1, 0)); columns_.back().sortable = true; - tab_table_ = new views::GroupTableView(table_model_.get(), columns_, - views::ICON_AND_TEXT, false, true, - true); + tab_table_.reset(new views::GroupTableView(table_model_.get(), columns_, + views::ICON_AND_TEXT, false, true, + true)); + tab_table_->SetParentOwned(false); // Hide some columns by default tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_PROCESS_ID_COLUMN, false); @@ -357,8 +358,7 @@ void TaskManagerViewImpl::ViewHierarchyChanged(bool is_add, if (is_add) { parent->AddChildView(kill_button_.get()); parent->AddChildView(about_memory_link_.get()); - if (tab_table_->GetParent() != this) - AddChildView(tab_table_); + AddChildView(tab_table_.get()); } else { parent->RemoveChildView(kill_button_.get()); parent->RemoveChildView(about_memory_link_.get()); |