Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / sprite_view_unittest.mm
blobbe68f19e80ae71cdfcd4bcd81c057d3cfabe8ee6
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import <Cocoa/Cocoa.h>
7 #include "base/mac/scoped_nsobject.h"
8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
9 #import "chrome/browser/ui/cocoa/sprite_view.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h"
12 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/gfx/image/image.h"
14 #include "ui/resources/grit/ui_resources.h"
16 namespace {
18 class SpriteViewTest : public CocoaTest {
19  public:
20   SpriteViewTest() {
21     image_.reset(ResourceBundle::GetSharedInstance()
22                      .GetNativeImageNamed(IDR_THROBBER)
23                      .CopyNSImage());
24     view_.reset([[SpriteView alloc] init]);
25     [view_ setImage:image_];
26     [[test_window() contentView] addSubview:view_];
27   }
29   base::scoped_nsobject<NSImage> image_;
30   base::scoped_nsobject<SpriteView> view_;
33 TEST_VIEW(SpriteViewTest, view_)
35 TEST_F(SpriteViewTest, TestViewFrame) {
36   NSSize imageSize = [image_ size];
37   NSRect frame = [view_ frame];
38   EXPECT_EQ(0.0, frame.origin.x);
39   EXPECT_EQ(0.0, frame.origin.y);
40   EXPECT_EQ(imageSize.height, NSWidth(frame));
41   EXPECT_EQ(imageSize.height, NSHeight(frame));
44 }  // namespace