Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/task_manager_browsertest.cc

Issue 465007: Unload the entire extension when any part of it crashes. (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/task_manager.h" 5 #include "chrome/browser/task_manager.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/browser_window.h" 9 #include "chrome/browser/browser_window.h"
10 #include "chrome/browser/extensions/extension_browsertest.h" 10 #include "chrome/browser/extensions/extension_browsertest.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 ASSERT_TRUE(LoadExtension( 112 ASSERT_TRUE(LoadExtension(
113 test_data_dir_.AppendASCII("common").AppendASCII("one_in_shelf"))); 113 test_data_dir_.AppendASCII("common").AppendASCII("one_in_shelf")));
114 WaitForResourceChange(3); 114 WaitForResourceChange(3);
115 115
116 // Make sure we also recognize extensions with just background pages. 116 // Make sure we also recognize extensions with just background pages.
117 ASSERT_TRUE(LoadExtension( 117 ASSERT_TRUE(LoadExtension(
118 test_data_dir_.AppendASCII("common").AppendASCII("background_page"))); 118 test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
119 WaitForResourceChange(4); 119 WaitForResourceChange(4);
120 } 120 }
121 121
122 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillExtension) {
123 // Show the task manager. This populates the model, and helps with debugging
124 // (you see the task manager).
125 browser()->window()->ShowTaskManager();
126
127 ASSERT_TRUE(LoadExtension(
128 test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
129
130 // Wait until we see the loaded extension in the task manager (the three
131 // resources are: the browser process, New Tab Page, and the extension).
132 WaitForResourceChange(3);
133
134 EXPECT_TRUE(model()->GetResourceExtension(0) == NULL);
135 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL);
136 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL);
137
138 // Kill the extension process and make sure we notice it.
139 TaskManager::GetInstance()->KillProcess(2);
140 WaitForResourceChange(2);
141 }
142
122 // Regression test for http://crbug.com/18693. 143 // Regression test for http://crbug.com/18693.
123 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, ReloadExtension) { 144 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, ReloadExtension) {
124 // Show the task manager. This populates the model, and helps with debugging 145 // Show the task manager. This populates the model, and helps with debugging
125 // (you see the task manager). 146 // (you see the task manager).
126 browser()->window()->ShowTaskManager(); 147 browser()->window()->ShowTaskManager();
127 148
128 ASSERT_TRUE(LoadExtension( 149 ASSERT_TRUE(LoadExtension(
129 test_data_dir_.AppendASCII("common").AppendASCII("background_page"))); 150 test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
130 151
131 // Wait until we see the loaded extension in the task manager (the three 152 // Wait until we see the loaded extension in the task manager (the three
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 WaitForResourceChange(3); 190 WaitForResourceChange(3);
170 191
171 // Check that we get some value for the cache columns. 192 // Check that we get some value for the cache columns.
172 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), 193 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2),
173 l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT)); 194 l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT));
174 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), 195 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2),
175 l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT)); 196 l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT));
176 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), 197 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2),
177 l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT)); 198 l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT));
178 } 199 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698