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

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

Issue 21308002: Update Mac notification tray behavior. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac tests. Created 7 years, 4 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/status_item_view.mm ('k') | ui/message_center/notification.cc » ('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/status_item_view.h" 5 #import "ui/message_center/cocoa/status_item_view.h"
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #import "ui/base/test/ui_cocoa_test_helper.h" 8 #import "ui/base/test/ui_cocoa_test_helper.h"
9 9
10 class StatusItemViewTest : public ui::CocoaTest { 10 class StatusItemViewTest : public ui::CocoaTest {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 got_callback = NO; 46 got_callback = NO;
47 [view_ otherMouseDown:nil]; 47 [view_ otherMouseDown:nil];
48 EXPECT_TRUE(got_callback); 48 EXPECT_TRUE(got_callback);
49 [view_ otherMouseUp:nil]; 49 [view_ otherMouseUp:nil];
50 } 50 }
51 51
52 TEST_F(StatusItemViewTest, UnreadCount) { 52 TEST_F(StatusItemViewTest, UnreadCount) {
53 CGFloat initial_width = NSWidth([view_ frame]); 53 CGFloat initial_width = NSWidth([view_ frame]);
54 54
55 CGFloat width = initial_width; 55 [view_ setUnreadCount:2 withQuietMode:NO];
56 [view_ setUnreadCount:2];
57 [view_ display]; 56 [view_ display];
58 EXPECT_GT(NSWidth([view_ frame]), width); 57 EXPECT_EQ(NSWidth([view_ frame]), initial_width);
59 width = NSWidth([view_ frame]);
60 58
61 [view_ setUnreadCount:10]; 59 [view_ setUnreadCount:0 withQuietMode:NO];
62 [view_ display]; 60 [view_ display];
63 EXPECT_GT(NSWidth([view_ frame]), width); 61 EXPECT_EQ(NSWidth([view_ frame]), initial_width);
64 width = NSWidth([view_ frame]);
65 62
66 CGFloat max_width = width; 63 [view_ setUnreadCount:1000 withQuietMode:YES];
64 [view_ display];
65 EXPECT_EQ(NSWidth([view_ frame]), initial_width);
67 66
68 [view_ setUnreadCount:0]; 67 [view_ setUnreadCount:0 withQuietMode:YES];
69 [view_ display]; 68 [view_ display];
70 EXPECT_LT(NSWidth([view_ frame]), width); 69 EXPECT_EQ(NSWidth([view_ frame]), initial_width);
71 width = NSWidth([view_ frame]);
72 EXPECT_CGFLOAT_EQ(width, initial_width);
73
74 [view_ setUnreadCount:1000];
75 [view_ display];
76 EXPECT_GT(NSWidth([view_ frame]), width);
77 width = NSWidth([view_ frame]);
78 EXPECT_CGFLOAT_EQ(width, max_width);
79 } 70 }
80 71
81 TEST_F(StatusItemViewTest, Highlight) { 72 TEST_F(StatusItemViewTest, Highlight) {
82 [view_ setHighlight:YES]; 73 [view_ setHighlight:YES];
83 [view_ display]; 74 [view_ display];
84 [view_ setHighlight:NO]; 75 [view_ setHighlight:NO];
85 [view_ display]; 76 [view_ display];
86 } 77 }
87 78
88 TEST_F(StatusItemViewTest, HighlightAndMouseEvent) { 79 TEST_F(StatusItemViewTest, HighlightAndMouseEvent) {
89 [view_ mouseDown:nil]; 80 [view_ mouseDown:nil];
90 [view_ display]; 81 [view_ display];
91 [view_ setHighlight:YES]; 82 [view_ setHighlight:YES];
92 [view_ display]; 83 [view_ display];
93 [view_ mouseUp:nil]; 84 [view_ mouseUp:nil];
94 [view_ display]; 85 [view_ display];
95 [view_ setHighlight:NO]; 86 [view_ setHighlight:NO];
96 [view_ display]; 87 [view_ display];
97 } 88 }
OLDNEW
« no previous file with comments | « ui/message_center/cocoa/status_item_view.mm ('k') | ui/message_center/notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698