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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell.h" 6 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell.h"
7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/mac/nsimage_cache.h" 10 #include "ui/gfx/mac/nsimage_cache.h"
(...skipping 17 matching lines...) Expand all
28 NSRect frame = NSMakeRect(0, 0, 50, 30); 28 NSRect frame = NSMakeRect(0, 0, 50, 30);
29 scoped_nsobject<NSButton> view([[NSButton alloc] initWithFrame:frame]); 29 scoped_nsobject<NSButton> view([[NSButton alloc] initWithFrame:frame]);
30 scoped_nsobject<NSButton> folder_view( 30 scoped_nsobject<NSButton> folder_view(
31 [[NSButton alloc] initWithFrame:frame]); 31 [[NSButton alloc] initWithFrame:frame]);
32 32
33 ASSERT_TRUE(view.get()); 33 ASSERT_TRUE(view.get());
34 ASSERT_TRUE(folder_view.get()); 34 ASSERT_TRUE(folder_view.get());
35 35
36 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 36 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
37 scoped_nsobject<NSImage> image( 37 scoped_nsobject<NSImage> image(
38 [rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) retain]); 38 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage());
39 ASSERT_TRUE(image.get()); 39 ASSERT_TRUE(image.get());
40 40
41 scoped_nsobject<BookmarkButtonCell> cell( 41 scoped_nsobject<BookmarkButtonCell> cell(
42 [[BookmarkButtonCell alloc] initTextCell:@"Testing"]); 42 [[BookmarkButtonCell alloc] initTextCell:@"Testing"]);
43 scoped_nsobject<BookmarkBarFolderButtonCell> folder_cell( 43 scoped_nsobject<BookmarkBarFolderButtonCell> folder_cell(
44 [[BookmarkBarFolderButtonCell buttonCellForNode:nil 44 [[BookmarkBarFolderButtonCell buttonCellForNode:nil
45 contextMenu:nil 45 contextMenu:nil
46 cellText:@"Testing" 46 cellText:@"Testing"
47 cellImage:image] retain]); 47 cellImage:image] retain]);
48 48
(...skipping 25 matching lines...) Expand all
74 74
75 [folder_cell setBookmarkCellText:@"test" image:image]; 75 [folder_cell setBookmarkCellText:@"test" image:image];
76 float folder_cell_x_with_title = ([cell imageRectForBounds:rect]).origin.x; 76 float folder_cell_x_with_title = ([cell imageRectForBounds:rect]).origin.x;
77 float folder_cell_width_with_title = ([cell cellSize]).width; 77 float folder_cell_width_with_title = ([cell cellSize]).width;
78 78
79 EXPECT_EQ(folder_cell_x_without_title, folder_cell_x_with_title); 79 EXPECT_EQ(folder_cell_x_without_title, folder_cell_x_with_title);
80 EXPECT_EQ(folder_cell_width_without_title, folder_cell_width_with_title); 80 EXPECT_EQ(folder_cell_width_without_title, folder_cell_width_with_title);
81 } 81 }
82 82
83 } // namespace 83 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698