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

Side by Side Diff: chrome/browser/ui/cocoa/styled_text_field_cell_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, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
8 #import "chrome/browser/ui/cocoa/styled_text_field_cell.h" 9 #import "chrome/browser/ui/cocoa/styled_text_field_cell.h"
9 #import "chrome/browser/ui/cocoa/styled_text_field_test_helper.h" 10 #import "chrome/browser/ui/cocoa/styled_text_field_test_helper.h"
10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "testing/platform_test.h" 12 #include "testing/platform_test.h"
13 13
14 namespace { 14 namespace {
15 15
16 // Width of the field so that we don't have to ask |field_| for it all 16 // Width of the field so that we don't have to ask |field_| for it all
17 // the time. 17 // the time.
18 const CGFloat kWidth(300.0); 18 const CGFloat kWidth(300.0);
19 19
20 class StyledTextFieldCellTest : public CocoaTest { 20 class StyledTextFieldCellTest : public CocoaTest {
21 public: 21 public:
22 StyledTextFieldCellTest() { 22 StyledTextFieldCellTest() {
23 // Make sure this is wide enough to play games with the cell 23 // Make sure this is wide enough to play games with the cell
24 // decorations. 24 // decorations.
25 const NSRect frame = NSMakeRect(0, 0, kWidth, 30); 25 const NSRect frame = NSMakeRect(0, 0, kWidth, 30);
26 26
27 scoped_nsobject<StyledTextFieldTestCell> cell( 27 base::scoped_nsobject<StyledTextFieldTestCell> cell(
28 [[StyledTextFieldTestCell alloc] initTextCell:@"Testing"]); 28 [[StyledTextFieldTestCell alloc] initTextCell:@"Testing"]);
29 cell_ = cell.get(); 29 cell_ = cell.get();
30 [cell_ setEditable:YES]; 30 [cell_ setEditable:YES];
31 [cell_ setBordered:YES]; 31 [cell_ setBordered:YES];
32 32
33 scoped_nsobject<NSTextField> view( 33 base::scoped_nsobject<NSTextField> view(
34 [[NSTextField alloc] initWithFrame:frame]); 34 [[NSTextField alloc] initWithFrame:frame]);
35 view_ = view.get(); 35 view_ = view.get();
36 [view_ setCell:cell_]; 36 [view_ setCell:cell_];
37 37
38 [[test_window() contentView] addSubview:view_]; 38 [[test_window() contentView] addSubview:view_];
39 } 39 }
40 40
41 NSTextField* view_; 41 NSTextField* view_;
42 StyledTextFieldTestCell* cell_; 42 StyledTextFieldTestCell* cell_;
43 }; 43 };
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 EXPECT_TRUE(NSContainsRect(NSInsetRect(textFrame, 1, 1), drawingRect)); 84 EXPECT_TRUE(NSContainsRect(NSInsetRect(textFrame, 1, 1), drawingRect));
85 85
86 [cell_ setLeftMargin:0]; 86 [cell_ setLeftMargin:0];
87 textFrame = [cell_ textFrameForFrame:bounds]; 87 textFrame = [cell_ textFrameForFrame:bounds];
88 drawingRect = [cell_ drawingRectForBounds:bounds]; 88 drawingRect = [cell_ drawingRectForBounds:bounds];
89 EXPECT_FALSE(NSIsEmptyRect(drawingRect)); 89 EXPECT_FALSE(NSIsEmptyRect(drawingRect));
90 EXPECT_TRUE(NSContainsRect(NSInsetRect(textFrame, 1, 1), drawingRect)); 90 EXPECT_TRUE(NSContainsRect(NSInsetRect(textFrame, 1, 1), drawingRect));
91 } 91 }
92 92
93 } // namespace 93 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698