| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/notifications/desktop_notification_service.h" | 10 #include "chrome/browser/notifications/desktop_notification_service.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 IN_PROC_BROWSER_TEST_F(TaskManagerNotificationBrowserTest, | 42 IN_PROC_BROWSER_TEST_F(TaskManagerNotificationBrowserTest, |
| 43 NoticeNotificationChanges) { | 43 NoticeNotificationChanges) { |
| 44 EXPECT_EQ(0, model()->ResourceCount()); | 44 EXPECT_EQ(0, model()->ResourceCount()); |
| 45 | 45 |
| 46 // Show the task manager. | 46 // Show the task manager. |
| 47 browser()->window()->ShowTaskManager(); | 47 browser()->window()->ShowTaskManager(); |
| 48 // Expect to see the browser and the New Tab Page renderer. | 48 // Expect to see the browser and the New Tab Page renderer. |
| 49 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | 49 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
| 50 | 50 |
| 51 // Show a notification. | 51 // Show a notification. |
| 52 NotificationUIManager* notifications = | 52 NotificationUIManager* notifications = |
| 53 g_browser_process->notification_ui_manager(); | 53 g_browser_process->notification_ui_manager(); |
| 54 | 54 |
| 55 string16 content = DesktopNotificationService::CreateDataUrl( | 55 string16 content = DesktopNotificationService::CreateDataUrl( |
| 56 GURL(), ASCIIToUTF16("Hello World!"), string16(), | 56 GURL(), ASCIIToUTF16("Hello World!"), string16(), |
| 57 WebKit::WebTextDirectionDefault); | 57 WebKit::WebTextDirectionDefault); |
| 58 | 58 |
| 59 scoped_refptr<NotificationDelegate> del1(new MockNotificationDelegate("n1")); | 59 scoped_refptr<NotificationDelegate> del1(new MockNotificationDelegate("n1")); |
| 60 Notification n1( | 60 Notification n1( |
| 61 GURL(), GURL(content), ASCIIToUTF16("Test 1"), string16(), del1.get()); | 61 GURL(), GURL(content), ASCIIToUTF16("Test 1"), string16(), del1.get()); |
| 62 scoped_refptr<NotificationDelegate> del2(new MockNotificationDelegate("n2")); | 62 scoped_refptr<NotificationDelegate> del2(new MockNotificationDelegate("n2")); |
| 63 Notification n2( | 63 Notification n2( |
| 64 GURL(), GURL(content), ASCIIToUTF16("Test 2"), string16(), del2.get()); | 64 GURL(), GURL(content), ASCIIToUTF16("Test 2"), string16(), del2.get()); |
| 65 | 65 |
| 66 notifications->Add(n1, browser()->profile()); | 66 notifications->Add(n1, browser()->profile()); |
| 67 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 67 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
| 68 notifications->Add(n2, browser()->profile()); | 68 notifications->Add(n2, browser()->profile()); |
| 69 TaskManagerBrowserTestUtil::WaitForResourceChange(4); | 69 TaskManagerBrowserTestUtil::WaitForWebResourceChange(3); |
| 70 notifications->CancelById(n1.notification_id()); | 70 notifications->CancelById(n1.notification_id()); |
| 71 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 71 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
| 72 notifications->CancelById(n2.notification_id()); | 72 notifications->CancelById(n2.notification_id()); |
| 73 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | 73 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
| 74 } | 74 } |
| 75 | 75 |
| 76 #endif // !USE_ASH | 76 #endif // !USE_ASH |
| OLD | NEW |