| OLD | NEW |
| 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/mac/scoped_nsobject.h" |
| 6 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 6 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 7 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 7 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 class ImageButtonCellTest : public CocoaTest { | 12 class ImageButtonCellTest : public CocoaTest { |
| 13 public: | 13 public: |
| 14 ImageButtonCellTest() { | 14 ImageButtonCellTest() { |
| 15 NSRect frame = NSMakeRect(0, 0, 50, 30); | 15 NSRect frame = NSMakeRect(0, 0, 50, 30); |
| 16 scoped_nsobject<NSButton>view([[NSButton alloc] initWithFrame:frame]); | 16 base::scoped_nsobject<NSButton> view( |
| 17 [[NSButton alloc] initWithFrame:frame]); |
| 17 view_ = view.get(); | 18 view_ = view.get(); |
| 18 scoped_nsobject<ImageButtonCell> cell( | 19 base::scoped_nsobject<ImageButtonCell> cell( |
| 19 [[ImageButtonCell alloc] initTextCell:@""]); | 20 [[ImageButtonCell alloc] initTextCell:@""]); |
| 20 [view_ setCell:cell.get()]; | 21 [view_ setCell:cell.get()]; |
| 21 [[test_window() contentView] addSubview:view_]; | 22 [[test_window() contentView] addSubview:view_]; |
| 22 } | 23 } |
| 23 | 24 |
| 24 void SetImages() { | 25 void SetImages() { |
| 25 [[view_ cell] setImageID:IDR_BACK | 26 [[view_ cell] setImageID:IDR_BACK |
| 26 forButtonState:image_button_cell::kDefaultState]; | 27 forButtonState:image_button_cell::kDefaultState]; |
| 27 [[view_ cell] setImageID:IDR_BACK_H | 28 [[view_ cell] setImageID:IDR_BACK_H |
| 28 forButtonState:image_button_cell::kHoverState]; | 29 forButtonState:image_button_cell::kHoverState]; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 forButtonState:image_button_cell::kDefaultState]; | 83 forButtonState:image_button_cell::kDefaultState]; |
| 83 [view_ display]; | 84 [view_ display]; |
| 84 EXPECT_FALSE([view_ needsDisplay]); | 85 EXPECT_FALSE([view_ needsDisplay]); |
| 85 | 86 |
| 86 [[view_ cell] setImageID:IDR_RELOAD | 87 [[view_ cell] setImageID:IDR_RELOAD |
| 87 forButtonState:image_button_cell::kDefaultState]; | 88 forButtonState:image_button_cell::kDefaultState]; |
| 88 EXPECT_TRUE([view_ needsDisplay]); | 89 EXPECT_TRUE([view_ needsDisplay]); |
| 89 } | 90 } |
| 90 | 91 |
| 91 } // namespace | 92 } // namespace |
| OLD | NEW |