diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 21:12:00 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 21:12:00 +0000 |
commit | 38baba4defaf68ba8f666a07e139df2a0a8e4ff2 (patch) | |
tree | 8029135137e4e68e58f4198d5d3bf3393274ba4f /chrome/browser/task_manager | |
parent | efbb4b4ba453f91562a437cff0d1bda8f3d1606e (diff) | |
download | chromium_src-38baba4defaf68ba8f666a07e139df2a0a8e4ff2.zip chromium_src-38baba4defaf68ba8f666a07e139df2a0a8e4ff2.tar.gz chromium_src-38baba4defaf68ba8f666a07e139df2a0a8e4ff2.tar.bz2 |
When notifications are closed by the user, send the notification to remove it rom the task manager. Add a browser test for the same.
BUG=46809
TEST=included (or for manual, open the task manager and create and dismiss notifications).
Review URL: http://codereview.chromium.org/4493002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager')
-rw-r--r-- | chrome/browser/task_manager/task_manager_browsertest.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc index 5828c22..9e3c181 100644 --- a/chrome/browser/task_manager/task_manager_browsertest.cc +++ b/chrome/browser/task_manager/task_manager_browsertest.cc @@ -6,11 +6,16 @@ #include "app/l10n_util.h" #include "base/file_path.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_navigator.h" +#include "chrome/browser/browser_process.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/notifications/desktop_notification_service.h" +#include "chrome/browser/notifications/notification_test_util.h" +#include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tabs/tab_strip_model.h" @@ -138,6 +143,39 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_NoticeExtensionChanges) { WaitForResourceChange(3); } +IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeNotificationChanges) { + EXPECT_EQ(0, model()->ResourceCount()); + + // Show the task manager. + browser()->window()->ShowTaskManager(); + // Expect to see the browser and the New Tab Page renderer. + EXPECT_EQ(2, model()->ResourceCount()); + + // Show a notification. + NotificationUIManager* notifications = + g_browser_process->notification_ui_manager(); + + string16 content = DesktopNotificationService::CreateDataUrl( + GURL(), ASCIIToUTF16("Hello World!"), string16(), + WebKit::WebTextDirectionDefault); + + scoped_refptr<NotificationDelegate> del1(new MockNotificationDelegate("n1")); + Notification n1( + GURL(), GURL(content), ASCIIToUTF16("Test 1"), string16(), del1.get()); + scoped_refptr<NotificationDelegate> del2(new MockNotificationDelegate("n2")); + Notification n2( + GURL(), GURL(content), ASCIIToUTF16("Test 2"), string16(), del2.get()); + + notifications->Add(n1, browser()->profile()); + WaitForResourceChange(3); + notifications->Add(n2, browser()->profile()); + WaitForResourceChange(4); + notifications->Cancel(n1); + WaitForResourceChange(3); + notifications->Cancel(n2); + WaitForResourceChange(2); +} + // Times out on Vista; disabled to keep tests fast. http://crbug.com/44991 #if defined(OS_WIN) #define KillExtension DISABLED_KillExtension |