| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | 43 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) |
| 44 #define MAYBE_NoticeNotificationChanges DISABLED_NoticeNotificationChanges | 44 #define MAYBE_NoticeNotificationChanges DISABLED_NoticeNotificationChanges |
| 45 #else | 45 #else |
| 46 #define MAYBE_NoticeNotificationChanges NoticeNotificationChanges | 46 #define MAYBE_NoticeNotificationChanges NoticeNotificationChanges |
| 47 #endif | 47 #endif |
| 48 IN_PROC_BROWSER_TEST_F(TaskManagerNotificationBrowserTest, | 48 IN_PROC_BROWSER_TEST_F(TaskManagerNotificationBrowserTest, |
| 49 MAYBE_NoticeNotificationChanges) { | 49 MAYBE_NoticeNotificationChanges) { |
| 50 EXPECT_EQ(0, model()->ResourceCount()); | 50 EXPECT_EQ(0, model()->ResourceCount()); |
| 51 | 51 |
| 52 // Show the task manager. | 52 // Show the task manager. |
| 53 browser()->window()->ShowTaskManager(chrome::HOST_DESKTOP_TYPE_NATIVE); | 53 browser()->window()->ShowTaskManager(); |
| 54 // Expect to see the browser and the New Tab Page renderer. | 54 // Expect to see the browser and the New Tab Page renderer. |
| 55 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); | 55 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
| 56 | 56 |
| 57 // Show a notification. | 57 // Show a notification. |
| 58 NotificationUIManager* notifications = | 58 NotificationUIManager* notifications = |
| 59 g_browser_process->notification_ui_manager(); | 59 g_browser_process->notification_ui_manager(); |
| 60 | 60 |
| 61 string16 content = DesktopNotificationService::CreateDataUrl( | 61 string16 content = DesktopNotificationService::CreateDataUrl( |
| 62 GURL(), ASCIIToUTF16("Hello World!"), string16(), | 62 GURL(), ASCIIToUTF16("Hello World!"), string16(), |
| 63 WebKit::WebTextDirectionDefault); | 63 WebKit::WebTextDirectionDefault); |
| 64 | 64 |
| 65 scoped_refptr<NotificationDelegate> del1(new MockNotificationDelegate("n1")); | 65 scoped_refptr<NotificationDelegate> del1(new MockNotificationDelegate("n1")); |
| 66 Notification n1( | 66 Notification n1( |
| 67 GURL(), GURL(content), ASCIIToUTF16("Test 1"), string16(), del1.get()); | 67 GURL(), GURL(content), ASCIIToUTF16("Test 1"), string16(), del1.get()); |
| 68 scoped_refptr<NotificationDelegate> del2(new MockNotificationDelegate("n2")); | 68 scoped_refptr<NotificationDelegate> del2(new MockNotificationDelegate("n2")); |
| 69 Notification n2( | 69 Notification n2( |
| 70 GURL(), GURL(content), ASCIIToUTF16("Test 2"), string16(), del2.get()); | 70 GURL(), GURL(content), ASCIIToUTF16("Test 2"), string16(), del2.get()); |
| 71 | 71 |
| 72 notifications->Add(n1, browser()->profile()); | 72 notifications->Add(n1, browser()->profile()); |
| 73 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); | 73 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
| 74 notifications->Add(n2, browser()->profile()); | 74 notifications->Add(n2, browser()->profile()); |
| 75 TaskManagerBrowserTestUtil::WaitForWebResourceChange(3); | 75 TaskManagerBrowserTestUtil::WaitForWebResourceChange(3); |
| 76 notifications->CancelById(n1.notification_id()); | 76 notifications->CancelById(n1.notification_id()); |
| 77 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); | 77 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
| 78 notifications->CancelById(n2.notification_id()); | 78 notifications->CancelById(n2.notification_id()); |
| 79 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); | 79 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
| 80 } | 80 } |
| 81 | 81 |
| 82 #endif // !USE_ASH | 82 #endif // !USE_ASH |
| OLD | NEW |