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

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

Issue 7053041: Add a Create method to DesktopNotificationHandler and stubs for the notification objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 6 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 | Annotate | Revision Log
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_contents_service.h" 9 #include "chrome/browser/background_contents_service.h"
10 #include "chrome/browser/background_contents_service_factory.h" 10 #include "chrome/browser/background_contents_service_factory.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), app_prefix, true)); 358 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), app_prefix, true));
359 359
360 // Disable extension and reload page. 360 // Disable extension and reload page.
361 DisableExtension(last_loaded_extension_id_); 361 DisableExtension(last_loaded_extension_id_);
362 ui_test_utils::NavigateToURL(browser(), url); 362 ui_test_utils::NavigateToURL(browser(), url);
363 363
364 // The third entry's title should be back to a normal tab. 364 // The third entry's title should be back to a normal tab.
365 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), tab_prefix, true)); 365 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), tab_prefix, true));
366 } 366 }
367 367
368 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeNotificationChanges) {
369 EXPECT_EQ(0, model()->ResourceCount());
370
371 // Show the task manager.
372 browser()->window()->ShowTaskManager();
373 // Expect to see the browser and the New Tab Page renderer.
374 WaitForResourceChange(2);
375
376 // Show a notification.
377 NotificationUIManager* notifications =
378 g_browser_process->notification_ui_manager();
379
380 string16 content = DesktopNotificationService::CreateDataUrl(
381 GURL(), ASCIIToUTF16("Hello World!"), string16(),
382 WebKit::WebTextDirectionDefault);
383
384 scoped_refptr<NotificationDelegate> del1(new MockNotificationDelegate("n1"));
385 Notification n1(
386 GURL(), GURL(content), ASCIIToUTF16("Test 1"), string16(), del1.get());
387 scoped_refptr<NotificationDelegate> del2(new MockNotificationDelegate("n2"));
388 Notification n2(
389 GURL(), GURL(content), ASCIIToUTF16("Test 2"), string16(), del2.get());
390
391 notifications->Add(n1, browser()->profile());
392 WaitForResourceChange(3);
393 notifications->Add(n2, browser()->profile());
394 WaitForResourceChange(4);
395 notifications->CancelById(n1.notification_id());
396 WaitForResourceChange(3);
397 notifications->CancelById(n2.notification_id());
398 WaitForResourceChange(2);
399 }
400
401 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillExtension) { 368 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillExtension) {
402 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount()); 369 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount());
403 // Show the task manager. This populates the model, and helps with debugging 370 // Show the task manager. This populates the model, and helps with debugging
404 // (you see the task manager). 371 // (you see the task manager).
405 browser()->window()->ShowTaskManager(); 372 browser()->window()->ShowTaskManager();
406 373
407 ASSERT_TRUE(LoadExtension( 374 ASSERT_TRUE(LoadExtension(
408 test_data_dir_.AppendASCII("common").AppendASCII("background_page"))); 375 test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
409 376
410 // Wait until we see the loaded extension in the task manager (the three 377 // Wait until we see the loaded extension in the task manager (the three
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 WaitForResourceChange(3); 485 WaitForResourceChange(3);
519 486
520 // Check that we get some value for the cache columns. 487 // Check that we get some value for the cache columns.
521 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), 488 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2),
522 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); 489 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
523 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), 490 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2),
524 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); 491 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
525 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), 492 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2),
526 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); 493 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
527 } 494 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698