diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-10 11:02:32 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-10 11:02:32 +0000 |
commit | ee8abdeb19fc1b8a90225176e36b3bb7f1bed1da (patch) | |
tree | 5ecd8607359289ff4a06bf5b92a81b7eee01eabc /chrome/browser/task_manager_browsertest.cc | |
parent | ea2328bc3c3c192a84134b38a1e3dae133c3044b (diff) | |
download | chromium_src-ee8abdeb19fc1b8a90225176e36b3bb7f1bed1da.zip chromium_src-ee8abdeb19fc1b8a90225176e36b3bb7f1bed1da.tar.gz chromium_src-ee8abdeb19fc1b8a90225176e36b3bb7f1bed1da.tar.bz2 |
Add more tests for extension crash recovery.
This should cover most cases I'd like to cover.
TEST=none
BUG=30405
Review URL: http://codereview.chromium.org/718002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager_browsertest.cc')
-rw-r--r-- | chrome/browser/task_manager_browsertest.cc | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/chrome/browser/task_manager_browsertest.cc b/chrome/browser/task_manager_browsertest.cc index 4d2eab8..d9f99cf 100644 --- a/chrome/browser/task_manager_browsertest.cc +++ b/chrome/browser/task_manager_browsertest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +7,10 @@ #include "app/l10n_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_window.h" +#include "chrome/browser/extensions/crashed_extension_infobar.h" #include "chrome/browser/extensions/extension_browsertest.h" +#include "chrome/browser/tab_contents/infobar_delegate.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/page_transition_types.h" #include "chrome/test/in_process_browser_test.h" @@ -145,6 +148,39 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillExtension) { WaitForResourceChange(2); } +IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillExtensionAndReload) { + // Show the task manager. This populates the model, and helps with debugging + // (you see the task manager). + browser()->window()->ShowTaskManager(); + + ASSERT_TRUE(LoadExtension( + test_data_dir_.AppendASCII("common").AppendASCII("background_page"))); + + // Wait until we see the loaded extension in the task manager (the three + // resources are: the browser process, New Tab Page, and the extension). + WaitForResourceChange(3); + + EXPECT_TRUE(model()->GetResourceExtension(0) == NULL); + EXPECT_TRUE(model()->GetResourceExtension(1) == NULL); + ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); + + // Kill the extension process and make sure we notice it. + TaskManager::GetInstance()->KillProcess(2); + WaitForResourceChange(2); + + // Reload the extension using the "crashed extension" infobar while the task + // manager is still visible. Make sure we don't crash and the extension + // gets reloaded and noticed in the task manager. + TabContents* current_tab = browser()->GetSelectedTabContents(); + ASSERT_EQ(1, current_tab->infobar_delegate_count()); + InfoBarDelegate* delegate = current_tab->GetInfoBarDelegateAt(0); + CrashedExtensionInfoBarDelegate* crashed_delegate = + delegate->AsCrashedExtensionInfoBarDelegate(); + ASSERT_TRUE(crashed_delegate); + crashed_delegate->Accept(); + WaitForResourceChange(3); +} + // Regression test for http://crbug.com/18693. IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, ReloadExtension) { // Show the task manager. This populates the model, and helps with debugging |