| 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/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 { |
| 11 public: | 11 public: |
| 12 StatusItemViewTest() | 12 StatusItemViewTest() |
| 13 : view_([[MCStatusItemView alloc] init]) { | 13 : view_([[MCStatusItemView alloc] init]) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 virtual void SetUp() OVERRIDE { | 16 virtual void SetUp() OVERRIDE { |
| 17 ui::CocoaTest::SetUp(); | 17 ui::CocoaTest::SetUp(); |
| 18 [[test_window() contentView] addSubview:view_]; | 18 [[test_window() contentView] addSubview:view_]; |
| 19 } | 19 } |
| 20 | 20 |
| 21 virtual void TearDown() OVERRIDE { | 21 virtual void TearDown() OVERRIDE { |
| 22 [view_ removeItem]; | 22 [view_ removeItem]; |
| 23 ui::CocoaTest::TearDown(); | 23 ui::CocoaTest::TearDown(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 protected: | 26 protected: |
| 27 scoped_nsobject<MCStatusItemView> view_; | 27 base::scoped_nsobject<MCStatusItemView> view_; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // These tests are like TEST_VIEW() but set some of the properties. | 30 // These tests are like TEST_VIEW() but set some of the properties. |
| 31 | 31 |
| 32 TEST_F(StatusItemViewTest, Callback) { | 32 TEST_F(StatusItemViewTest, Callback) { |
| 33 __block BOOL got_callback = NO; | 33 __block BOOL got_callback = NO; |
| 34 [view_ setCallback:^{ | 34 [view_ setCallback:^{ |
| 35 got_callback = YES; | 35 got_callback = YES; |
| 36 }]; | 36 }]; |
| 37 [view_ mouseDown:nil]; | 37 [view_ mouseDown:nil]; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 TEST_F(StatusItemViewTest, HighlightAndMouseEvent) { | 88 TEST_F(StatusItemViewTest, HighlightAndMouseEvent) { |
| 89 [view_ mouseDown:nil]; | 89 [view_ mouseDown:nil]; |
| 90 [view_ display]; | 90 [view_ display]; |
| 91 [view_ setHighlight:YES]; | 91 [view_ setHighlight:YES]; |
| 92 [view_ display]; | 92 [view_ display]; |
| 93 [view_ mouseUp:nil]; | 93 [view_ mouseUp:nil]; |
| 94 [view_ display]; | 94 [view_ display]; |
| 95 [view_ setHighlight:NO]; | 95 [view_ setHighlight:NO]; |
| 96 [view_ display]; | 96 [view_ display]; |
| 97 } | 97 } |
| OLD | NEW |