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

Side by Side Diff: chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc

Issue 554213003: Request the icon of a Web Notification in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the tests Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/views/message_center/web_notification_tray.h" 5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/system/status_area_widget.h" 10 #include "ash/system/status_area_widget.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 private: 59 private:
60 virtual ~TestNotificationDelegate() {} 60 virtual ~TestNotificationDelegate() {}
61 61
62 std::string id_; 62 std::string id_;
63 }; 63 };
64 64
65 void AddNotification(const std::string& id, const std::string& replace_id) { 65 void AddNotification(const std::string& id, const std::string& replace_id) {
66 ::Notification notification(GURL("chrome-extension://abbccedd"), 66 ::Notification notification(GURL("chrome-extension://abbccedd"),
67 GURL(),
68 base::ASCIIToUTF16("Test Web Notification"), 67 base::ASCIIToUTF16("Test Web Notification"),
69 base::ASCIIToUTF16( 68 base::ASCIIToUTF16(
70 "Notification message body."), 69 "Notification message body."),
71 blink::WebTextDirectionDefault, 70 gfx::Image(),
72 base::string16(), 71 base::string16(),
73 base::ASCIIToUTF16(replace_id), 72 base::ASCIIToUTF16(replace_id),
74 new TestNotificationDelegate(id)); 73 new TestNotificationDelegate(id));
75 74
76 g_browser_process->notification_ui_manager()->Add( 75 g_browser_process->notification_ui_manager()->Add(
77 notification, browser()->profile()); 76 notification, browser()->profile());
78 } 77 }
79 78
80 void UpdateNotification(const std::string& replace_id, 79 void UpdateNotification(const std::string& replace_id,
81 const std::string& new_id) { 80 const std::string& new_id) {
82 ::Notification notification(GURL("chrome-extension://abbccedd"), 81 ::Notification notification(GURL("chrome-extension://abbccedd"),
83 GURL(""),
84 base::ASCIIToUTF16("Updated Web Notification"), 82 base::ASCIIToUTF16("Updated Web Notification"),
85 base::ASCIIToUTF16("Updated message body."), 83 base::ASCIIToUTF16("Updated message body."),
86 blink::WebTextDirectionDefault, 84 gfx::Image(),
87 base::string16(), 85 base::string16(),
88 base::ASCIIToUTF16(replace_id), 86 base::ASCIIToUTF16(replace_id),
89 new TestNotificationDelegate(new_id)); 87 new TestNotificationDelegate(new_id));
90 88
91 g_browser_process->notification_ui_manager()->Add( 89 g_browser_process->notification_ui_manager()->Add(notification,
92 notification, browser()->profile()); 90 browser()->profile());
93 } 91 }
94 92
95 void RemoveNotification(const std::string& id) { 93 void RemoveNotification(const std::string& id) {
96 g_browser_process->notification_ui_manager()->CancelById(id); 94 g_browser_process->notification_ui_manager()->CancelById(id);
97 } 95 }
98 96
99 bool HasNotification(message_center::MessageCenter* message_center, 97 bool HasNotification(message_center::MessageCenter* message_center,
100 const std::string& id) { 98 const std::string& id) {
101 return message_center->FindVisibleNotificationById(id) != NULL; 99 return message_center->FindVisibleNotificationById(id) != NULL;
102 } 100 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 base::RunLoop().RunUntilIdle(); 243 base::RunLoop().RunUntilIdle();
246 EXPECT_TRUE(tray->status_icon_ == NULL); 244 EXPECT_TRUE(tray->status_icon_ == NULL);
247 AddNotification("test_id", "replace_id"); 245 AddNotification("test_id", "replace_id");
248 base::RunLoop().RunUntilIdle(); 246 base::RunLoop().RunUntilIdle();
249 EXPECT_TRUE(tray->status_icon_ != NULL); 247 EXPECT_TRUE(tray->status_icon_ != NULL);
250 RemoveNotification("test_id"); 248 RemoveNotification("test_id");
251 base::RunLoop().RunUntilIdle(); 249 base::RunLoop().RunUntilIdle();
252 EXPECT_TRUE(tray->status_icon_ == NULL); 250 EXPECT_TRUE(tray->status_icon_ == NULL);
253 } 251 }
254 } // namespace message_center 252 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698