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

Unified Diff: ui/message_center/cocoa/notification_controller_unittest.mm

Issue 101473003: Do not allow creating dummy notifier id from production, for safety. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: ui/message_center/cocoa/notification_controller_unittest.mm
diff --git a/ui/message_center/cocoa/notification_controller_unittest.mm b/ui/message_center/cocoa/notification_controller_unittest.mm
index 8ba6026782d5a305504e625d3a5b4ae809e02995..783ad119aaf5770573af2b03d30f7131a6cbe7ee 100644
--- a/ui/message_center/cocoa/notification_controller_unittest.mm
+++ b/ui/message_center/cocoa/notification_controller_unittest.mm
@@ -55,7 +55,7 @@ class MockMessageCenter : public message_center::FakeMessageCenter {
DISALLOW_COPY_AND_ASSIGN(MockMessageCenter);
};
-}
+} // namespace
@implementation MCNotificationController (TestingInterface)
- (NSButton*)closeButton {
@@ -93,11 +93,18 @@ class MockMessageCenter : public message_center::FakeMessageCenter {
}
@end
+namespace message_center {
+
class NotificationControllerTest : public ui::CocoaTest {
public:
NSImage* TestIcon() {
return [NSImage imageNamed:NSImageNameUser];
}
+
+ protected:
+ message_center::NotifierId DummyNotifierId() {
+ return message_center::NotifierId();
+ }
};
TEST_F(NotificationControllerTest, BasicLayout) {
@@ -109,7 +116,7 @@ TEST_F(NotificationControllerTest, BasicLayout) {
ASCIIToUTF16("Jonathan and 5 others"),
gfx::Image(),
string16(),
- message_center::NotifierId(),
+ DummyNotifierId(),
message_center::RichNotificationData(),
NULL));
notification->set_icon(gfx::Image([TestIcon() retain]));
@@ -139,7 +146,7 @@ TEST_F(NotificationControllerTest, OverflowText) {
"entire thing?"),
gfx::Image(),
string16(),
- message_center::NotifierId(),
+ DummyNotifierId(),
message_center::RichNotificationData(),
NULL));
base::scoped_nsobject<MCNotificationController> controller(
@@ -160,7 +167,7 @@ TEST_F(NotificationControllerTest, Close) {
string16(),
gfx::Image(),
string16(),
- message_center::NotifierId(),
+ DummyNotifierId(),
message_center::RichNotificationData(),
NULL));
MockMessageCenter message_center;
@@ -187,7 +194,7 @@ TEST_F(NotificationControllerTest, Update) {
"default bounds."),
gfx::Image(),
string16(),
- message_center::NotifierId(),
+ DummyNotifierId(),
message_center::RichNotificationData(),
NULL));
base::scoped_nsobject<MCNotificationController> controller(
@@ -223,7 +230,7 @@ TEST_F(NotificationControllerTest, Buttons) {
string16(),
gfx::Image(),
string16(),
- message_center::NotifierId(),
+ DummyNotifierId(),
optional,
NULL));
MockMessageCenter message_center;
@@ -248,7 +255,7 @@ TEST_F(NotificationControllerTest, Image) {
string16(),
gfx::Image(),
string16(),
- message_center::NotifierId(),
+ DummyNotifierId(),
message_center::RichNotificationData(),
NULL));
NSImage* image = [NSImage imageNamed:NSImageNameFolder];
@@ -290,7 +297,7 @@ TEST_F(NotificationControllerTest, List) {
UTF8ToUTF16("Notification Message - should be hidden"),
gfx::Image(),
string16(),
- message_center::NotifierId(),
+ DummyNotifierId(),
optional,
NULL));
@@ -308,3 +315,5 @@ TEST_F(NotificationControllerTest, List) {
EXPECT_LT(NSMaxY([[controller listView] frame]),
NSMinY([[controller titleView] frame]));
}
+
+} // namespace message_center

Powered by Google App Engine
This is Rietveld 408576698