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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_button_unittest.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/memory/scoped_nsobject.h" 5 #import "base/mac/scoped_nsobject.h"
6 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
6 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" 7 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "testing/platform_test.h" 9 #include "testing/platform_test.h"
10 10
11 class ConstrainedWindowButtonTest : public CocoaTest { 11 class ConstrainedWindowButtonTest : public CocoaTest {
12 public: 12 public:
13 ConstrainedWindowButtonTest() { 13 ConstrainedWindowButtonTest() {
14 NSRect frame = NSMakeRect(0, 0, 50, 30); 14 NSRect frame = NSMakeRect(0, 0, 50, 30);
15 button_.reset([[ConstrainedWindowButton alloc] initWithFrame:frame]); 15 button_.reset([[ConstrainedWindowButton alloc] initWithFrame:frame]);
16 [button_ setTitle:@"Abcdefg"]; 16 [button_ setTitle:@"Abcdefg"];
17 [button_ sizeToFit]; 17 [button_ sizeToFit];
18 [[test_window() contentView] addSubview:button_]; 18 [[test_window() contentView] addSubview:button_];
19 } 19 }
20 20
21 protected: 21 protected:
22 scoped_nsobject<ConstrainedWindowButton> button_; 22 base::scoped_nsobject<ConstrainedWindowButton> button_;
23 }; 23 };
24 24
25 TEST_VIEW(ConstrainedWindowButtonTest, button_) 25 TEST_VIEW(ConstrainedWindowButtonTest, button_)
26 26
27 // Test hover, mostly to ensure nothing leaks or crashes. 27 // Test hover, mostly to ensure nothing leaks or crashes.
28 TEST_F(ConstrainedWindowButtonTest, DisplayWithHover) { 28 TEST_F(ConstrainedWindowButtonTest, DisplayWithHover) {
29 [[button_ cell] setIsMouseInside:NO]; 29 [[button_ cell] setIsMouseInside:NO];
30 [button_ display]; 30 [button_ display];
31 [[button_ cell] setIsMouseInside:YES]; 31 [[button_ cell] setIsMouseInside:YES];
32 [button_ display]; 32 [button_ display];
(...skipping 18 matching lines...) Expand all
51 // Tracking rects 51 // Tracking rects
52 TEST_F(ConstrainedWindowButtonTest, TrackingRects) { 52 TEST_F(ConstrainedWindowButtonTest, TrackingRects) {
53 ConstrainedWindowButtonCell* cell = [button_ cell]; 53 ConstrainedWindowButtonCell* cell = [button_ cell];
54 EXPECT_FALSE([cell isMouseInside]); 54 EXPECT_FALSE([cell isMouseInside]);
55 55
56 [button_ mouseEntered:nil]; 56 [button_ mouseEntered:nil];
57 EXPECT_TRUE([cell isMouseInside]); 57 EXPECT_TRUE([cell isMouseInside]);
58 [button_ mouseExited:nil]; 58 [button_ mouseExited:nil];
59 EXPECT_FALSE([cell isMouseInside]); 59 EXPECT_FALSE([cell isMouseInside]);
60 } 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698