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/status_item_view.h" | 5 #import "ui/message_center/cocoa/status_item_view.h" |
6 | 6 |
7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // These tests are like TEST_VIEW() but set some of the properties. | 34 // These tests are like TEST_VIEW() but set some of the properties. |
35 | 35 |
36 TEST_F(StatusItemViewTest, Callback) { | 36 TEST_F(StatusItemViewTest, Callback) { |
37 __block BOOL got_callback = NO; | 37 __block BOOL got_callback = NO; |
38 [view_ setCallback:^{ | 38 [view_ setCallback:^{ |
39 got_callback = YES; | 39 got_callback = YES; |
40 }]; | 40 }]; |
41 [view_ mouseDown:nil]; | 41 [view_ mouseDown:nil]; |
42 EXPECT_TRUE(got_callback); | 42 EXPECT_TRUE(got_callback); |
| 43 [view_ mouseUp:nil]; |
| 44 |
| 45 got_callback = NO; |
| 46 [view_ rightMouseDown:nil]; |
| 47 EXPECT_TRUE(got_callback); |
| 48 [view_ rightMouseUp:nil]; |
| 49 |
| 50 got_callback = NO; |
| 51 [view_ otherMouseDown:nil]; |
| 52 EXPECT_TRUE(got_callback); |
| 53 [view_ otherMouseUp:nil]; |
43 } | 54 } |
44 | 55 |
45 TEST_F(StatusItemViewTest, UnreadCount) { | 56 TEST_F(StatusItemViewTest, UnreadCount) { |
46 [view_ setUnreadCount:2]; | 57 [view_ setUnreadCount:2]; |
47 [view_ display]; | 58 [view_ display]; |
48 [view_ setUnreadCount:10]; | 59 [view_ setUnreadCount:10]; |
49 [view_ display]; | 60 [view_ display]; |
50 [view_ setUnreadCount:0]; | 61 [view_ setUnreadCount:0]; |
51 [view_ display]; | 62 [view_ display]; |
52 [view_ setUnreadCount:1000]; | 63 [view_ setUnreadCount:1000]; |
(...skipping 10 matching lines...) Expand all Loading... |
63 TEST_F(StatusItemViewTest, HighlightAndMouseEvent) { | 74 TEST_F(StatusItemViewTest, HighlightAndMouseEvent) { |
64 [view_ mouseDown:nil]; | 75 [view_ mouseDown:nil]; |
65 [view_ display]; | 76 [view_ display]; |
66 [view_ setHighlight:YES]; | 77 [view_ setHighlight:YES]; |
67 [view_ display]; | 78 [view_ display]; |
68 [view_ mouseUp:nil]; | 79 [view_ mouseUp:nil]; |
69 [view_ display]; | 80 [view_ display]; |
70 [view_ setHighlight:NO]; | 81 [view_ setHighlight:NO]; |
71 [view_ display]; | 82 [view_ display]; |
72 } | 83 } |
OLD | NEW |