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

Side by Side Diff: ui/message_center/cocoa/tray_view_controller_unittest.mm

Issue 288033014: Remove Notifications Associated with an Extension When the Extension is Unchecked from the Message … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Unit Test That Left Dangling Pointer Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/message_center/cocoa/settings_controller.mm ('k') | ui/message_center/message_center_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tray_view_controller.h" 5 #import "ui/message_center/cocoa/tray_view_controller.h"
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // There are 0 notifications, but 2 notifiers. The settings pane should be 241 // There are 0 notifications, but 2 notifiers. The settings pane should be
242 // higher than the empty tray bubble. 242 // higher than the empty tray bubble.
243 EXPECT_LT(trayHeight, NSHeight([[tray_ view] frame])); 243 EXPECT_LT(trayHeight, NSHeight([[tray_ view] frame]));
244 244
245 [tray_ showMessages:nil]; 245 [tray_ showMessages:nil];
246 EXPECT_EQ(1, provider.closed_called_count()); 246 EXPECT_EQ(1, provider.closed_called_count());
247 EXPECT_TRUE(center_->IsMessageCenterVisible()); 247 EXPECT_TRUE(center_->IsMessageCenterVisible());
248 248
249 // The tray should be back at its previous height now. 249 // The tray should be back at its previous height now.
250 EXPECT_EQ(trayHeight, NSHeight([[tray_ view] frame])); 250 EXPECT_EQ(trayHeight, NSHeight([[tray_ view] frame]));
251
252 // Clean up since this frame owns FakeNotifierSettingsProvider.
253 center_->SetNotifierSettingsProvider(NULL);
251 } 254 }
252 255
253 TEST_F(TrayViewControllerTest, EmptyCenter) { 256 TEST_F(TrayViewControllerTest, EmptyCenter) {
254 EXPECT_FALSE([[tray_ emptyDescription] isHidden]); 257 EXPECT_FALSE([[tray_ emptyDescription] isHidden]);
255 258
256 // With no notifications, the divider should be hidden. 259 // With no notifications, the divider should be hidden.
257 EXPECT_TRUE([[tray_ divider] isHidden]); 260 EXPECT_TRUE([[tray_ divider] isHidden]);
258 EXPECT_TRUE([[tray_ scrollView] isHidden]); 261 EXPECT_TRUE([[tray_ scrollView] isHidden]);
259 262
260 scoped_ptr<message_center::Notification> notification; 263 scoped_ptr<message_center::Notification> notification;
261 notification.reset(new message_center::Notification( 264 notification.reset(new message_center::Notification(
262 message_center::NOTIFICATION_TYPE_SIMPLE, 265 message_center::NOTIFICATION_TYPE_SIMPLE,
263 "1", 266 "1",
264 ASCIIToUTF16("First notification"), 267 ASCIIToUTF16("First notification"),
265 ASCIIToUTF16("This is a simple test."), 268 ASCIIToUTF16("This is a simple test."),
266 gfx::Image(), 269 gfx::Image(),
267 base::string16(), 270 base::string16(),
268 DummyNotifierId(), 271 DummyNotifierId(),
269 message_center::RichNotificationData(), 272 message_center::RichNotificationData(),
270 NULL)); 273 NULL));
271 center_->AddNotification(notification.Pass()); 274 center_->AddNotification(notification.Pass());
272 [tray_ onMessageCenterTrayChanged]; 275 [tray_ onMessageCenterTrayChanged];
273 276
274 EXPECT_FALSE([[tray_ divider] isHidden]); 277 EXPECT_FALSE([[tray_ divider] isHidden]);
275 EXPECT_FALSE([[tray_ scrollView] isHidden]); 278 EXPECT_FALSE([[tray_ scrollView] isHidden]);
276 EXPECT_TRUE([[tray_ emptyDescription] isHidden]); 279 EXPECT_TRUE([[tray_ emptyDescription] isHidden]);
277 } 280 }
278 281
279 } // namespace message_center 282 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/cocoa/settings_controller.mm ('k') | ui/message_center/message_center_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698