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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration_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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" 7 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h"
8 8
9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 10 matching lines...) Expand all
21 21
22 // Test that the decoration gets smaller when there's not enough space 22 // Test that the decoration gets smaller when there's not enough space
23 // to fit, within bounds. 23 // to fit, within bounds.
24 TEST_F(EVBubbleDecorationTest, MiddleElide) { 24 TEST_F(EVBubbleDecorationTest, MiddleElide) {
25 NSString* kLongString = @"A very long string with spaces"; 25 NSString* kLongString = @"A very long string with spaces";
26 const CGFloat kWide = 1000.0; // Wide enough to fit everything. 26 const CGFloat kWide = 1000.0; // Wide enough to fit everything.
27 const CGFloat kNarrow = 10.0; // Too narrow for anything. 27 const CGFloat kNarrow = 10.0; // Too narrow for anything.
28 const CGFloat kMinimumWidth = 100.0; // Never should get this small. 28 const CGFloat kMinimumWidth = 100.0; // Never should get this small.
29 29
30 const NSSize kImageSize = NSMakeSize(20.0, 20.0); 30 const NSSize kImageSize = NSMakeSize(20.0, 20.0);
31 scoped_nsobject<NSImage> image([[NSImage alloc] initWithSize:kImageSize]); 31 base::scoped_nsobject<NSImage> image(
32 [[NSImage alloc] initWithSize:kImageSize]);
32 33
33 decoration_.SetImage(image); 34 decoration_.SetImage(image);
34 decoration_.SetFullLabel(kLongString); 35 decoration_.SetFullLabel(kLongString);
35 36
36 // Lots of space, decoration not omitted. 37 // Lots of space, decoration not omitted.
37 EXPECT_NE(decoration_.GetWidthForSpace(kWide), 38 EXPECT_NE(decoration_.GetWidthForSpace(kWide),
38 LocationBarDecoration::kOmittedWidth); 39 LocationBarDecoration::kOmittedWidth);
39 40
40 // If the available space is of the same magnitude as the required 41 // If the available space is of the same magnitude as the required
41 // space, the decoration doesn't eat it all up. 42 // space, the decoration doesn't eat it all up.
42 const CGFloat long_width = decoration_.GetWidthForSpace(kWide); 43 const CGFloat long_width = decoration_.GetWidthForSpace(kWide);
43 EXPECT_NE(decoration_.GetWidthForSpace(long_width + 20.0), 44 EXPECT_NE(decoration_.GetWidthForSpace(long_width + 20.0),
44 LocationBarDecoration::kOmittedWidth); 45 LocationBarDecoration::kOmittedWidth);
45 EXPECT_LT(decoration_.GetWidthForSpace(long_width + 20.0), long_width); 46 EXPECT_LT(decoration_.GetWidthForSpace(long_width + 20.0), long_width);
46 47
47 // If there is very little space, the decoration is still relatively 48 // If there is very little space, the decoration is still relatively
48 // big. 49 // big.
49 EXPECT_NE(decoration_.GetWidthForSpace(kNarrow), 50 EXPECT_NE(decoration_.GetWidthForSpace(kNarrow),
50 LocationBarDecoration::kOmittedWidth); 51 LocationBarDecoration::kOmittedWidth);
51 EXPECT_GT(decoration_.GetWidthForSpace(kNarrow), kMinimumWidth); 52 EXPECT_GT(decoration_.GetWidthForSpace(kNarrow), kMinimumWidth);
52 } 53 }
53 54
54 } // namespace 55 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698