| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #import "ui/message_center/cocoa/notification_controller.h" | 5 #import "ui/message_center/cocoa/notification_controller.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 #import "ui/base/cocoa/hover_image_button.h" | 15 #import "ui/base/cocoa/hover_image_button.h" |
| 15 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 16 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
| 16 #include "ui/message_center/fake_message_center.h" | 17 #include "ui/message_center/fake_message_center.h" |
| 17 #include "ui/message_center/message_center_style.h" | 18 #include "ui/message_center/message_center_style.h" |
| 18 #include "ui/message_center/notification.h" | 19 #include "ui/message_center/notification.h" |
| 19 #include "ui/message_center/notification_types.h" | 20 #include "ui/message_center/notification_types.h" |
| 20 | 21 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return [NSImage imageNamed:NSImageNameUser]; | 124 return [NSImage imageNamed:NSImageNameUser]; |
| 124 } | 125 } |
| 125 | 126 |
| 126 protected: | 127 protected: |
| 127 message_center::NotifierId DummyNotifierId() { | 128 message_center::NotifierId DummyNotifierId() { |
| 128 return message_center::NotifierId(); | 129 return message_center::NotifierId(); |
| 129 } | 130 } |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 TEST_F(NotificationControllerTest, BasicLayout) { | 133 TEST_F(NotificationControllerTest, BasicLayout) { |
| 133 scoped_ptr<message_center::Notification> notification( | 134 std::unique_ptr<message_center::Notification> notification( |
| 134 new message_center::Notification( | 135 new message_center::Notification( |
| 135 message_center::NOTIFICATION_TYPE_SIMPLE, "", | 136 message_center::NOTIFICATION_TYPE_SIMPLE, "", |
| 136 ASCIIToUTF16("Added to circles"), | 137 ASCIIToUTF16("Added to circles"), |
| 137 ASCIIToUTF16("Jonathan and 5 others"), gfx::Image(), base::string16(), | 138 ASCIIToUTF16("Jonathan and 5 others"), gfx::Image(), base::string16(), |
| 138 GURL(), DummyNotifierId(), message_center::RichNotificationData(), | 139 GURL(), DummyNotifierId(), message_center::RichNotificationData(), |
| 139 NULL)); | 140 NULL)); |
| 140 gfx::Image testIcon([TestIcon() retain]); | 141 gfx::Image testIcon([TestIcon() retain]); |
| 141 notification->set_icon(testIcon); | 142 notification->set_icon(testIcon); |
| 142 notification->set_small_image(testIcon); | 143 notification->set_small_image(testIcon); |
| 143 | 144 |
| 144 base::scoped_nsobject<MCNotificationController> controller( | 145 base::scoped_nsobject<MCNotificationController> controller( |
| 145 [[MCNotificationController alloc] initWithNotification:notification.get() | 146 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 146 messageCenter:NULL]); | 147 messageCenter:NULL]); |
| 147 [controller view]; | 148 [controller view]; |
| 148 | 149 |
| 149 EXPECT_EQ(TestIcon(), [[controller iconView] image]); | 150 EXPECT_EQ(TestIcon(), [[controller iconView] image]); |
| 150 EXPECT_EQ(TestIcon(), [[controller smallImageView] image]); | 151 EXPECT_EQ(TestIcon(), [[controller smallImageView] image]); |
| 151 EXPECT_EQ(base::SysNSStringToUTF16([[controller titleView] string]), | 152 EXPECT_EQ(base::SysNSStringToUTF16([[controller titleView] string]), |
| 152 notification->title()); | 153 notification->title()); |
| 153 EXPECT_EQ(base::SysNSStringToUTF16([[controller messageView] string]), | 154 EXPECT_EQ(base::SysNSStringToUTF16([[controller messageView] string]), |
| 154 notification->message()); | 155 notification->message()); |
| 155 EXPECT_EQ(controller.get(), [[controller closeButton] target]); | 156 EXPECT_EQ(controller.get(), [[controller closeButton] target]); |
| 156 } | 157 } |
| 157 | 158 |
| 158 TEST_F(NotificationControllerTest, NotificationSetttingsButtonLayout) { | 159 TEST_F(NotificationControllerTest, NotificationSetttingsButtonLayout) { |
| 159 scoped_ptr<message_center::Notification> notification( | 160 std::unique_ptr<message_center::Notification> notification( |
| 160 new message_center::Notification( | 161 new message_center::Notification( |
| 161 message_center::NOTIFICATION_TYPE_SIMPLE, "", | 162 message_center::NOTIFICATION_TYPE_SIMPLE, "", |
| 162 ASCIIToUTF16("Added to circles"), | 163 ASCIIToUTF16("Added to circles"), |
| 163 ASCIIToUTF16("Jonathan and 5 others"), gfx::Image(), base::string16(), | 164 ASCIIToUTF16("Jonathan and 5 others"), gfx::Image(), base::string16(), |
| 164 GURL("https://plus.com"), DummyNotifierId(), | 165 GURL("https://plus.com"), DummyNotifierId(), |
| 165 message_center::RichNotificationData(), | 166 message_center::RichNotificationData(), |
| 166 new NotificationSettingsDelegate())); | 167 new NotificationSettingsDelegate())); |
| 167 | 168 |
| 168 base::scoped_nsobject<MCNotificationController> controller( | 169 base::scoped_nsobject<MCNotificationController> controller( |
| 169 [[MCNotificationController alloc] initWithNotification:notification.get() | 170 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 170 messageCenter:nullptr]); | 171 messageCenter:nullptr]); |
| 171 [controller view]; | 172 [controller view]; |
| 172 EXPECT_EQ(controller.get(), [[controller settingsButton] target]); | 173 EXPECT_EQ(controller.get(), [[controller settingsButton] target]); |
| 173 } | 174 } |
| 174 | 175 |
| 175 TEST_F(NotificationControllerTest, ContextMessageAsDomainNotificationLayout) { | 176 TEST_F(NotificationControllerTest, ContextMessageAsDomainNotificationLayout) { |
| 176 scoped_ptr<message_center::Notification> notification( | 177 std::unique_ptr<message_center::Notification> notification( |
| 177 new message_center::Notification( | 178 new message_center::Notification( |
| 178 message_center::NOTIFICATION_TYPE_SIMPLE, "", | 179 message_center::NOTIFICATION_TYPE_SIMPLE, "", |
| 179 ASCIIToUTF16("Added to circles"), | 180 ASCIIToUTF16("Added to circles"), |
| 180 ASCIIToUTF16("Jonathan and 5 others"), gfx::Image(), base::string16(), | 181 ASCIIToUTF16("Jonathan and 5 others"), gfx::Image(), base::string16(), |
| 181 GURL("https://plus.com"), DummyNotifierId(), | 182 GURL("https://plus.com"), DummyNotifierId(), |
| 182 message_center::RichNotificationData(), new NotificationDelegate())); | 183 message_center::RichNotificationData(), new NotificationDelegate())); |
| 183 base::scoped_nsobject<MCNotificationController> controller( | 184 base::scoped_nsobject<MCNotificationController> controller( |
| 184 [[MCNotificationController alloc] initWithNotification:notification.get() | 185 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 185 messageCenter:nullptr]); | 186 messageCenter:nullptr]); |
| 186 [controller view]; | 187 [controller view]; |
| 187 | 188 |
| 188 EXPECT_EQ(base::SysNSStringToUTF8([[controller contextMessageView] string]), | 189 EXPECT_EQ(base::SysNSStringToUTF8([[controller contextMessageView] string]), |
| 189 "plus.com"); | 190 "plus.com"); |
| 190 } | 191 } |
| 191 | 192 |
| 192 TEST_F(NotificationControllerTest, OverflowText) { | 193 TEST_F(NotificationControllerTest, OverflowText) { |
| 193 scoped_ptr<message_center::Notification> notification( | 194 std::unique_ptr<message_center::Notification> notification( |
| 194 new message_center::Notification( | 195 new message_center::Notification( |
| 195 message_center::NOTIFICATION_TYPE_SIMPLE, "", | 196 message_center::NOTIFICATION_TYPE_SIMPLE, "", |
| 196 ASCIIToUTF16("This is a much longer title that should wrap " | 197 ASCIIToUTF16("This is a much longer title that should wrap " |
| 197 "multiple lines."), | 198 "multiple lines."), |
| 198 ASCIIToUTF16("And even the message is long. This sure is a wordy " | 199 ASCIIToUTF16("And even the message is long. This sure is a wordy " |
| 199 "notification. Are you really going to read this " | 200 "notification. Are you really going to read this " |
| 200 "entire thing?"), | 201 "entire thing?"), |
| 201 gfx::Image(), base::string16(), GURL(), DummyNotifierId(), | 202 gfx::Image(), base::string16(), GURL(), DummyNotifierId(), |
| 202 message_center::RichNotificationData(), NULL)); | 203 message_center::RichNotificationData(), NULL)); |
| 203 base::scoped_nsobject<MCNotificationController> controller( | 204 base::scoped_nsobject<MCNotificationController> controller( |
| 204 [[MCNotificationController alloc] initWithNotification:notification.get() | 205 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 205 messageCenter:NULL]); | 206 messageCenter:NULL]); |
| 206 [controller view]; | 207 [controller view]; |
| 207 | 208 |
| 208 EXPECT_GT(NSHeight([[controller view] frame]), | 209 EXPECT_GT(NSHeight([[controller view] frame]), |
| 209 message_center::kNotificationIconSize); | 210 message_center::kNotificationIconSize); |
| 210 } | 211 } |
| 211 | 212 |
| 212 TEST_F(NotificationControllerTest, Close) { | 213 TEST_F(NotificationControllerTest, Close) { |
| 213 scoped_ptr<message_center::Notification> notification( | 214 std::unique_ptr<message_center::Notification> notification( |
| 214 new message_center::Notification( | 215 new message_center::Notification( |
| 215 message_center::NOTIFICATION_TYPE_SIMPLE, "an_id", base::string16(), | 216 message_center::NOTIFICATION_TYPE_SIMPLE, "an_id", base::string16(), |
| 216 base::string16(), gfx::Image(), base::string16(), GURL(), | 217 base::string16(), gfx::Image(), base::string16(), GURL(), |
| 217 DummyNotifierId(), message_center::RichNotificationData(), NULL)); | 218 DummyNotifierId(), message_center::RichNotificationData(), NULL)); |
| 218 MockMessageCenter message_center; | 219 MockMessageCenter message_center; |
| 219 | 220 |
| 220 base::scoped_nsobject<MCNotificationController> controller( | 221 base::scoped_nsobject<MCNotificationController> controller( |
| 221 [[MCNotificationController alloc] initWithNotification:notification.get() | 222 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 222 messageCenter:&message_center]); | 223 messageCenter:&message_center]); |
| 223 [controller view]; | 224 [controller view]; |
| 224 | 225 |
| 225 [[controller closeButton] performClick:nil]; | 226 [[controller closeButton] performClick:nil]; |
| 226 | 227 |
| 227 EXPECT_EQ(1, message_center.remove_count()); | 228 EXPECT_EQ(1, message_center.remove_count()); |
| 228 EXPECT_EQ("an_id", message_center.last_removed_id()); | 229 EXPECT_EQ("an_id", message_center.last_removed_id()); |
| 229 EXPECT_TRUE(message_center.last_removed_by_user()); | 230 EXPECT_TRUE(message_center.last_removed_by_user()); |
| 230 } | 231 } |
| 231 | 232 |
| 232 TEST_F(NotificationControllerTest, Update) { | 233 TEST_F(NotificationControllerTest, Update) { |
| 233 scoped_ptr<message_center::Notification> notification( | 234 std::unique_ptr<message_center::Notification> notification( |
| 234 new message_center::Notification( | 235 new message_center::Notification( |
| 235 message_center::NOTIFICATION_TYPE_SIMPLE, "", | 236 message_center::NOTIFICATION_TYPE_SIMPLE, "", |
| 236 ASCIIToUTF16("A simple title"), | 237 ASCIIToUTF16("A simple title"), |
| 237 ASCIIToUTF16("This message isn't too long and should fit in the" | 238 ASCIIToUTF16("This message isn't too long and should fit in the" |
| 238 "default bounds."), | 239 "default bounds."), |
| 239 gfx::Image(), base::string16(), GURL(), DummyNotifierId(), | 240 gfx::Image(), base::string16(), GURL(), DummyNotifierId(), |
| 240 message_center::RichNotificationData(), NULL)); | 241 message_center::RichNotificationData(), NULL)); |
| 241 base::scoped_nsobject<MCNotificationController> controller( | 242 base::scoped_nsobject<MCNotificationController> controller( |
| 242 [[MCNotificationController alloc] initWithNotification:notification.get() | 243 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 243 messageCenter:NULL]); | 244 messageCenter:NULL]); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 260 message_center::kNotificationIconSize); | 261 message_center::kNotificationIconSize); |
| 261 } | 262 } |
| 262 | 263 |
| 263 TEST_F(NotificationControllerTest, Buttons) { | 264 TEST_F(NotificationControllerTest, Buttons) { |
| 264 message_center::RichNotificationData optional; | 265 message_center::RichNotificationData optional; |
| 265 message_center::ButtonInfo button1(UTF8ToUTF16("button1")); | 266 message_center::ButtonInfo button1(UTF8ToUTF16("button1")); |
| 266 optional.buttons.push_back(button1); | 267 optional.buttons.push_back(button1); |
| 267 message_center::ButtonInfo button2(UTF8ToUTF16("button2")); | 268 message_center::ButtonInfo button2(UTF8ToUTF16("button2")); |
| 268 optional.buttons.push_back(button2); | 269 optional.buttons.push_back(button2); |
| 269 | 270 |
| 270 scoped_ptr<message_center::Notification> notification( | 271 std::unique_ptr<message_center::Notification> notification( |
| 271 new message_center::Notification( | 272 new message_center::Notification( |
| 272 message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", | 273 message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", |
| 273 base::string16(), base::string16(), gfx::Image(), base::string16(), | 274 base::string16(), base::string16(), gfx::Image(), base::string16(), |
| 274 GURL(), DummyNotifierId(), optional, NULL)); | 275 GURL(), DummyNotifierId(), optional, NULL)); |
| 275 MockMessageCenter message_center; | 276 MockMessageCenter message_center; |
| 276 | 277 |
| 277 base::scoped_nsobject<MCNotificationController> controller( | 278 base::scoped_nsobject<MCNotificationController> controller( |
| 278 [[MCNotificationController alloc] initWithNotification:notification.get() | 279 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 279 messageCenter:&message_center]); | 280 messageCenter:&message_center]); |
| 280 [controller view]; | 281 [controller view]; |
| 281 | 282 |
| 282 [[controller secondButton] performClick:nil]; | 283 [[controller secondButton] performClick:nil]; |
| 283 | 284 |
| 284 EXPECT_EQ("an_id", message_center.last_clicked_id()); | 285 EXPECT_EQ("an_id", message_center.last_clicked_id()); |
| 285 EXPECT_EQ(1, message_center.last_clicked_index()); | 286 EXPECT_EQ(1, message_center.last_clicked_index()); |
| 286 } | 287 } |
| 287 | 288 |
| 288 TEST_F(NotificationControllerTest, Image) { | 289 TEST_F(NotificationControllerTest, Image) { |
| 289 scoped_ptr<message_center::Notification> notification( | 290 std::unique_ptr<message_center::Notification> notification( |
| 290 new message_center::Notification( | 291 new message_center::Notification( |
| 291 message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", | 292 message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", |
| 292 base::string16(), base::string16(), gfx::Image(), base::string16(), | 293 base::string16(), base::string16(), gfx::Image(), base::string16(), |
| 293 GURL(), DummyNotifierId(), message_center::RichNotificationData(), | 294 GURL(), DummyNotifierId(), message_center::RichNotificationData(), |
| 294 NULL)); | 295 NULL)); |
| 295 NSImage* image = [NSImage imageNamed:NSImageNameFolder]; | 296 NSImage* image = [NSImage imageNamed:NSImageNameFolder]; |
| 296 notification->set_image(gfx::Image([image retain])); | 297 notification->set_image(gfx::Image([image retain])); |
| 297 | 298 |
| 298 MockMessageCenter message_center; | 299 MockMessageCenter message_center; |
| 299 | 300 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 317 message_center::NotificationItem item2( | 318 message_center::NotificationItem item2( |
| 318 UTF8ToUTF16("Second title"), | 319 UTF8ToUTF16("Second title"), |
| 319 UTF8ToUTF16("second slightly longer message")); | 320 UTF8ToUTF16("second slightly longer message")); |
| 320 optional.items.push_back(item2); | 321 optional.items.push_back(item2); |
| 321 message_center::NotificationItem item3( | 322 message_center::NotificationItem item3( |
| 322 UTF8ToUTF16(""), // Test for empty string. | 323 UTF8ToUTF16(""), // Test for empty string. |
| 323 UTF8ToUTF16(" ")); // Test for string containing only spaces. | 324 UTF8ToUTF16(" ")); // Test for string containing only spaces. |
| 324 optional.items.push_back(item3); | 325 optional.items.push_back(item3); |
| 325 optional.context_message = UTF8ToUTF16("Context Message"); | 326 optional.context_message = UTF8ToUTF16("Context Message"); |
| 326 | 327 |
| 327 scoped_ptr<message_center::Notification> notification( | 328 std::unique_ptr<message_center::Notification> notification( |
| 328 new message_center::Notification( | 329 new message_center::Notification( |
| 329 message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", | 330 message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", |
| 330 UTF8ToUTF16("Notification Title"), | 331 UTF8ToUTF16("Notification Title"), |
| 331 UTF8ToUTF16("Notification Message - should be hidden"), gfx::Image(), | 332 UTF8ToUTF16("Notification Message - should be hidden"), gfx::Image(), |
| 332 base::string16(), GURL(), DummyNotifierId(), optional, NULL)); | 333 base::string16(), GURL(), DummyNotifierId(), optional, NULL)); |
| 333 | 334 |
| 334 MockMessageCenter message_center; | 335 MockMessageCenter message_center; |
| 335 base::scoped_nsobject<MCNotificationController> controller( | 336 base::scoped_nsobject<MCNotificationController> controller( |
| 336 [[MCNotificationController alloc] initWithNotification:notification.get() | 337 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 337 messageCenter:&message_center]); | 338 messageCenter:&message_center]); |
| 338 [controller view]; | 339 [controller view]; |
| 339 | 340 |
| 340 EXPECT_FALSE([[controller titleView] isHidden]); | 341 EXPECT_FALSE([[controller titleView] isHidden]); |
| 341 EXPECT_TRUE([[controller messageView] isHidden]); | 342 EXPECT_TRUE([[controller messageView] isHidden]); |
| 342 EXPECT_FALSE([[controller contextMessageView] isHidden]); | 343 EXPECT_FALSE([[controller contextMessageView] isHidden]); |
| 343 | 344 |
| 344 EXPECT_EQ(3u, [[[controller listView] subviews] count]); | 345 EXPECT_EQ(3u, [[[controller listView] subviews] count]); |
| 345 EXPECT_LT(NSMaxY([[controller listView] frame]), | 346 EXPECT_LT(NSMaxY([[controller listView] frame]), |
| 346 NSMinY([[controller titleView] frame])); | 347 NSMinY([[controller titleView] frame])); |
| 347 } | 348 } |
| 348 | 349 |
| 349 TEST_F(NotificationControllerTest, NoMessage) { | 350 TEST_F(NotificationControllerTest, NoMessage) { |
| 350 message_center::RichNotificationData optional; | 351 message_center::RichNotificationData optional; |
| 351 optional.context_message = UTF8ToUTF16("Context Message"); | 352 optional.context_message = UTF8ToUTF16("Context Message"); |
| 352 | 353 |
| 353 scoped_ptr<message_center::Notification> notification( | 354 std::unique_ptr<message_center::Notification> notification( |
| 354 new message_center::Notification( | 355 new message_center::Notification( |
| 355 message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", | 356 message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", |
| 356 UTF8ToUTF16("Notification Title"), UTF8ToUTF16(""), gfx::Image(), | 357 UTF8ToUTF16("Notification Title"), UTF8ToUTF16(""), gfx::Image(), |
| 357 base::string16(), GURL(), DummyNotifierId(), optional, NULL)); | 358 base::string16(), GURL(), DummyNotifierId(), optional, NULL)); |
| 358 | 359 |
| 359 MockMessageCenter message_center; | 360 MockMessageCenter message_center; |
| 360 base::scoped_nsobject<MCNotificationController> controller( | 361 base::scoped_nsobject<MCNotificationController> controller( |
| 361 [[MCNotificationController alloc] initWithNotification:notification.get() | 362 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 362 messageCenter:&message_center]); | 363 messageCenter:&message_center]); |
| 363 [controller view]; | 364 [controller view]; |
| 364 | 365 |
| 365 EXPECT_FALSE([[controller titleView] isHidden]); | 366 EXPECT_FALSE([[controller titleView] isHidden]); |
| 366 EXPECT_TRUE([[controller messageView] isHidden]); | 367 EXPECT_TRUE([[controller messageView] isHidden]); |
| 367 EXPECT_FALSE([[controller contextMessageView] isHidden]); | 368 EXPECT_FALSE([[controller contextMessageView] isHidden]); |
| 368 } | 369 } |
| 369 | 370 |
| 370 TEST_F(NotificationControllerTest, MessageSize) { | 371 TEST_F(NotificationControllerTest, MessageSize) { |
| 371 message_center::RichNotificationData data; | 372 message_center::RichNotificationData data; |
| 372 std::string id("id"); | 373 std::string id("id"); |
| 373 NotifierId notifier_id(NotifierId::APPLICATION, "notifier"); | 374 NotifierId notifier_id(NotifierId::APPLICATION, "notifier"); |
| 374 scoped_ptr<Notification> notification(new Notification( | 375 std::unique_ptr<Notification> notification(new Notification( |
| 375 NOTIFICATION_TYPE_BASE_FORMAT, id, base::UTF8ToUTF16(""), | 376 NOTIFICATION_TYPE_BASE_FORMAT, id, base::UTF8ToUTF16(""), |
| 376 ASCIIToUTF16("And\neven\nthe\nmessage is long.\nThis sure is wordy"), | 377 ASCIIToUTF16("And\neven\nthe\nmessage is long.\nThis sure is wordy"), |
| 377 gfx::Image(), base::string16() /* display_source */, GURL(), notifier_id, | 378 gfx::Image(), base::string16() /* display_source */, GURL(), notifier_id, |
| 378 data, NULL /* delegate */)); | 379 data, NULL /* delegate */)); |
| 379 | 380 |
| 380 base::scoped_nsobject<MCNotificationController> controller( | 381 base::scoped_nsobject<MCNotificationController> controller( |
| 381 [[MCNotificationController alloc] initWithNotification:notification.get() | 382 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 382 messageCenter:NULL]); | 383 messageCenter:NULL]); |
| 383 | 384 |
| 384 // Set up the default layout. | 385 // Set up the default layout. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 notification->set_title(ASCIIToUTF16("one line")); | 435 notification->set_title(ASCIIToUTF16("one line")); |
| 435 [controller updateNotification:notification.get()]; | 436 [controller updateNotification:notification.get()]; |
| 436 EXPECT_EQ(1u, compute_message_lines()); | 437 EXPECT_EQ(1u, compute_message_lines()); |
| 437 | 438 |
| 438 notification->set_title(ASCIIToUTF16("two\nlines")); | 439 notification->set_title(ASCIIToUTF16("two\nlines")); |
| 439 [controller updateNotification:notification.get()]; | 440 [controller updateNotification:notification.get()]; |
| 440 EXPECT_EQ(0u, compute_message_lines()); | 441 EXPECT_EQ(0u, compute_message_lines()); |
| 441 } | 442 } |
| 442 | 443 |
| 443 } // namespace message_center | 444 } // namespace message_center |
| OLD | NEW |