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

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

Issue 8221018: WebUI TaskManager: Turn it on-by-default on Win/Mac/Linux (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: review fix Created 9 years, 2 months 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 | « build/common.gypi ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/task_manager.h" 5 #include "chrome/browser/task_manager/task_manager.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/background/background_contents_service.h" 9 #include "chrome/browser/background/background_contents_service.h"
10 #include "chrome/browser/background/background_contents_service_factory.h" 10 #include "chrome/browser/background/background_contents_service_factory.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Unload extension to avoid crash on Windows (see http://crbug.com/31663). 200 // Unload extension to avoid crash on Windows (see http://crbug.com/31663).
201 UnloadExtension(last_loaded_extension_id_); 201 UnloadExtension(last_loaded_extension_id_);
202 TaskManagerBrowserTestUtil::WaitForResourceChange(2); 202 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
203 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount()); 203 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount());
204 } 204 }
205 205
206 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeExtensionTabs) { 206 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeExtensionTabs) {
207 // Show the task manager. This populates the model, and helps with debugging 207 // Show the task manager. This populates the model, and helps with debugging
208 // (you see the task manager). 208 // (you see the task manager).
209 browser()->window()->ShowTaskManager(); 209 browser()->window()->ShowTaskManager();
210 // Wait for loading of task manager.
211 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
210 212
211 ASSERT_TRUE(LoadExtension( 213 ASSERT_TRUE(LoadExtension(
212 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") 214 test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
213 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") 215 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
214 .AppendASCII("1.0.0.0"))); 216 .AppendASCII("1.0.0.0")));
215 217
216 // Browser, Extension background page, and the New Tab Page. 218 // Browser, Extension background page, and the New Tab Page.
217 TaskManagerBrowserTestUtil::WaitForResourceChange(3); 219 TaskManagerBrowserTestUtil::WaitForResourceChange(3);
218 220
219 // Open a new tab to an extension URL and make sure we notice that. 221 // Open a new tab to an extension URL and make sure we notice that.
(...skipping 19 matching lines...) Expand all
239 241
240 // Unload extension to avoid crash on Windows. 242 // Unload extension to avoid crash on Windows.
241 UnloadExtension(last_loaded_extension_id_); 243 UnloadExtension(last_loaded_extension_id_);
242 TaskManagerBrowserTestUtil::WaitForResourceChange(2); 244 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
243 } 245 }
244 246
245 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTabs) { 247 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTabs) {
246 // Show the task manager. This populates the model, and helps with debugging 248 // Show the task manager. This populates the model, and helps with debugging
247 // (you see the task manager). 249 // (you see the task manager).
248 browser()->window()->ShowTaskManager(); 250 browser()->window()->ShowTaskManager();
251 // Wait for loading of task manager.
252 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
249 253
250 ASSERT_TRUE(LoadExtension( 254 ASSERT_TRUE(LoadExtension(
251 test_data_dir_.AppendASCII("packaged_app"))); 255 test_data_dir_.AppendASCII("packaged_app")));
252 ExtensionService* service = browser()->profile()->GetExtensionService(); 256 ExtensionService* service = browser()->profile()->GetExtensionService();
253 const Extension* extension = 257 const Extension* extension =
254 service->GetExtensionById(last_loaded_extension_id_, false); 258 service->GetExtensionById(last_loaded_extension_id_, false);
255 259
256 // Browser and the New Tab Page. 260 // Browser and the New Tab Page.
257 TaskManagerBrowserTestUtil::WaitForResourceChange(2); 261 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
258 262
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 327
324 // The third entry's title should be back to a normal tab. 328 // The third entry's title should be back to a normal tab.
325 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), tab_prefix, true)); 329 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), tab_prefix, true));
326 } 330 }
327 331
328 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_KillExtension) { 332 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_KillExtension) {
329 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount()); 333 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount());
330 // Show the task manager. This populates the model, and helps with debugging 334 // Show the task manager. This populates the model, and helps with debugging
331 // (you see the task manager). 335 // (you see the task manager).
332 browser()->window()->ShowTaskManager(); 336 browser()->window()->ShowTaskManager();
337 // Wait for loading of task manager.
338 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
333 339
334 ASSERT_TRUE(LoadExtension( 340 ASSERT_TRUE(LoadExtension(
335 test_data_dir_.AppendASCII("common").AppendASCII("background_page"))); 341 test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
336 342
337 // Wait until we see the loaded extension in the task manager (the three 343 // Wait until we see the loaded extension in the task manager (the three
338 // resources are: the browser process, New Tab Page, and the extension). 344 // resources are: the browser process, New Tab Page, and the extension).
339 TaskManagerBrowserTestUtil::WaitForResourceChange(3); 345 TaskManagerBrowserTestUtil::WaitForResourceChange(3);
340 EXPECT_EQ(1, TaskManager::GetBackgroundPageCount()); 346 EXPECT_EQ(1, TaskManager::GetBackgroundPageCount());
341 347
342 EXPECT_TRUE(model()->GetResourceExtension(0) == NULL); 348 EXPECT_TRUE(model()->GetResourceExtension(0) == NULL);
343 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL); 349 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL);
344 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); 350 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL);
345 351
346 // Kill the extension process and make sure we notice it. 352 // Kill the extension process and make sure we notice it.
347 TaskManager::GetInstance()->KillProcess(2); 353 TaskManager::GetInstance()->KillProcess(2);
348 TaskManagerBrowserTestUtil::WaitForResourceChange(2); 354 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
349 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount()); 355 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount());
350 } 356 }
351 357
352 // Disabled, http://crbug.com/66957. 358 // Disabled, http://crbug.com/66957.
353 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, 359 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest,
354 DISABLED_KillExtensionAndReload) { 360 DISABLED_KillExtensionAndReload) {
355 // Show the task manager. This populates the model, and helps with debugging 361 // Show the task manager. This populates the model, and helps with debugging
356 // (you see the task manager). 362 // (you see the task manager).
357 browser()->window()->ShowTaskManager(); 363 browser()->window()->ShowTaskManager();
364 // Wait for loading of task manager.
365 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
358 366
359 ASSERT_TRUE(LoadExtension( 367 ASSERT_TRUE(LoadExtension(
360 test_data_dir_.AppendASCII("common").AppendASCII("background_page"))); 368 test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
361 369
362 // Wait until we see the loaded extension in the task manager (the three 370 // Wait until we see the loaded extension in the task manager (the three
363 // resources are: the browser process, New Tab Page, and the extension). 371 // resources are: the browser process, New Tab Page, and the extension).
364 TaskManagerBrowserTestUtil::WaitForResourceChange(3); 372 TaskManagerBrowserTestUtil::WaitForResourceChange(3);
365 373
366 EXPECT_TRUE(model()->GetResourceExtension(0) == NULL); 374 EXPECT_TRUE(model()->GetResourceExtension(0) == NULL);
367 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL); 375 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL);
(...skipping 21 matching lines...) Expand all
389 #define MAYBE_ReloadExtension FLAKY_ReloadExtension 397 #define MAYBE_ReloadExtension FLAKY_ReloadExtension
390 #else 398 #else
391 #define MAYBE_ReloadExtension ReloadExtension 399 #define MAYBE_ReloadExtension ReloadExtension
392 #endif 400 #endif
393 401
394 // Regression test for http://crbug.com/18693. 402 // Regression test for http://crbug.com/18693.
395 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_ReloadExtension) { 403 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_ReloadExtension) {
396 // Show the task manager. This populates the model, and helps with debugging 404 // Show the task manager. This populates the model, and helps with debugging
397 // (you see the task manager). 405 // (you see the task manager).
398 browser()->window()->ShowTaskManager(); 406 browser()->window()->ShowTaskManager();
407 // Wait for loading of task manager.
408 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
399 409
400 LOG(INFO) << "loading extension"; 410 LOG(INFO) << "loading extension";
401 ASSERT_TRUE(LoadExtension( 411 ASSERT_TRUE(LoadExtension(
402 test_data_dir_.AppendASCII("common").AppendASCII("background_page"))); 412 test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
403 413
404 // Wait until we see the loaded extension in the task manager (the three 414 // Wait until we see the loaded extension in the task manager (the three
405 // resources are: the browser process, New Tab Page, and the extension). 415 // resources are: the browser process, New Tab Page, and the extension).
406 LOG(INFO) << "waiting for resource change"; 416 LOG(INFO) << "waiting for resource change";
407 TaskManagerBrowserTestUtil::WaitForResourceChange(3); 417 TaskManagerBrowserTestUtil::WaitForResourceChange(3);
408 418
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 TaskManagerBrowserTestUtil::WaitForResourceChange(3); 461 TaskManagerBrowserTestUtil::WaitForResourceChange(3);
452 462
453 // Check that we get some value for the cache columns. 463 // Check that we get some value for the cache columns.
454 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), 464 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2),
455 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); 465 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
456 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), 466 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2),
457 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); 467 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
458 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), 468 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2),
459 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); 469 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
460 } 470 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698