| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #import "chrome/browser/cocoa/gradient_button_cell.h" | 8 #import "chrome/browser/cocoa/gradient_button_cell.h" |
| 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 EXPECT_EQ(cocoa_helper_.contentView(), [view_ superview]); | 32 EXPECT_EQ(cocoa_helper_.contentView(), [view_ superview]); |
| 33 [view_.get() removeFromSuperview]; | 33 [view_.get() removeFromSuperview]; |
| 34 EXPECT_FALSE([view_ superview]); | 34 EXPECT_FALSE([view_ superview]); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Test drawing, mostly to ensure nothing leaks or crashes. | 37 // Test drawing, mostly to ensure nothing leaks or crashes. |
| 38 TEST_F(GradientButtonCellTest, Display) { | 38 TEST_F(GradientButtonCellTest, Display) { |
| 39 [view_ display]; | 39 [view_ display]; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Tracking rects |
| 43 TEST_F(GradientButtonCellTest, TrackingRects) { |
| 44 GradientButtonCell* cell = [view_ cell]; |
| 45 EXPECT_FALSE([cell showsBorderOnlyWhileMouseInside]); |
| 46 EXPECT_FALSE([cell isMouseInside]); |
| 47 |
| 48 [cell setShowsBorderOnlyWhileMouseInside:YES]; |
| 49 [cell mouseEntered:nil]; |
| 50 EXPECT_TRUE([cell isMouseInside]); |
| 51 [cell mouseExited:nil]; |
| 52 EXPECT_FALSE([cell isMouseInside]); |
| 53 |
| 54 [cell setShowsBorderOnlyWhileMouseInside:NO]; |
| 55 EXPECT_FALSE([cell isMouseInside]); |
| 56 |
| 57 [cell setShowsBorderOnlyWhileMouseInside:YES]; |
| 58 [cell setShowsBorderOnlyWhileMouseInside:YES]; |
| 59 [cell setShowsBorderOnlyWhileMouseInside:NO]; |
| 60 [cell setShowsBorderOnlyWhileMouseInside:NO]; |
| 61 } |
| 62 |
| 42 } // namespace | 63 } // namespace |
| OLD | NEW |