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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell_unittest.mm

Issue 10933083: Remove deprecated gfx::Image::operator NSImage*(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments and merge Created 8 years, 3 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
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 #include "base/memory/scoped_nsobject.h" 5 #include "base/memory/scoped_nsobject.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/bookmarks/bookmark_model.h" 7 #include "chrome/browser/bookmarks/bookmark_model.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 TEST_F(BookmarkButtonCellTest, IconOnlySqueeze) { 61 TEST_F(BookmarkButtonCellTest, IconOnlySqueeze) {
62 NSRect frame = NSMakeRect(0, 0, 50, 30); 62 NSRect frame = NSMakeRect(0, 0, 50, 30);
63 scoped_nsobject<NSButton> view([[NSButton alloc] initWithFrame:frame]); 63 scoped_nsobject<NSButton> view([[NSButton alloc] initWithFrame:frame]);
64 scoped_nsobject<BookmarkButtonCell> cell( 64 scoped_nsobject<BookmarkButtonCell> cell(
65 [[BookmarkButtonCell alloc] initTextCell:@"Testing"]); 65 [[BookmarkButtonCell alloc] initTextCell:@"Testing"]);
66 [view setCell:cell.get()]; 66 [view setCell:cell.get()];
67 [[test_window() contentView] addSubview:view]; 67 [[test_window() contentView] addSubview:view];
68 68
69 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 69 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
70 scoped_nsobject<NSImage> image( 70 scoped_nsobject<NSImage> image(
71 [rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) retain]); 71 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage());
72 EXPECT_TRUE(image.get()); 72 EXPECT_TRUE(image.get());
73 73
74 NSRect r = NSMakeRect(0, 0, 100, 100); 74 NSRect r = NSMakeRect(0, 0, 100, 100);
75 [cell setBookmarkCellText:@" " image:image]; 75 [cell setBookmarkCellText:@" " image:image];
76 CGFloat two_space_width = [cell.get() cellSizeForBounds:r].width; 76 CGFloat two_space_width = [cell.get() cellSizeForBounds:r].width;
77 [cell setBookmarkCellText:@" " image:image]; 77 [cell setBookmarkCellText:@" " image:image];
78 CGFloat one_space_width = [cell.get() cellSizeForBounds:r].width; 78 CGFloat one_space_width = [cell.get() cellSizeForBounds:r].width;
79 [cell setBookmarkCellText:@"" image:image]; 79 [cell setBookmarkCellText:@"" image:image];
80 CGFloat zero_space_width = [cell.get() cellSizeForBounds:r].width; 80 CGFloat zero_space_width = [cell.get() cellSizeForBounds:r].width;
81 81
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 ASSERT_TRUE(bookmark_cell.get()); 200 ASSERT_TRUE(bookmark_cell.get());
201 201
202 EXPECT_EQ(1, [gradient_cell verticalTextOffset]); 202 EXPECT_EQ(1, [gradient_cell verticalTextOffset]);
203 EXPECT_EQ(0, [bookmark_cell verticalTextOffset]); 203 EXPECT_EQ(0, [bookmark_cell verticalTextOffset]);
204 204
205 EXPECT_NE([bookmark_cell verticalTextOffset], 205 EXPECT_NE([bookmark_cell verticalTextOffset],
206 [gradient_cell verticalTextOffset]); 206 [gradient_cell verticalTextOffset]);
207 } 207 }
208 208
209 } // namespace 209 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698