| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "base/mac/mac_util.h" |
| 7 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 9 #import "chrome/browser/ui/cocoa/sprite_view.h" | 10 #import "chrome/browser/ui/cocoa/sprite_view.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
| 12 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 13 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
| 14 #include "ui/resources/grit/ui_resources.h" | 15 #include "ui/resources/grit/ui_resources.h" |
| 15 | 16 |
| 16 @interface SpriteView (ExposedForTesting) | 17 @interface SpriteView (ExposedForTesting) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 TEST_F(SpriteViewTest, TestViewFrame) { | 50 TEST_F(SpriteViewTest, TestViewFrame) { |
| 50 NSSize imageSize = [image_ size]; | 51 NSSize imageSize = [image_ size]; |
| 51 NSRect frame = [view_ frame]; | 52 NSRect frame = [view_ frame]; |
| 52 EXPECT_EQ(0.0, frame.origin.x); | 53 EXPECT_EQ(0.0, frame.origin.x); |
| 53 EXPECT_EQ(0.0, frame.origin.y); | 54 EXPECT_EQ(0.0, frame.origin.y); |
| 54 EXPECT_EQ(imageSize.height, NSWidth(frame)); | 55 EXPECT_EQ(imageSize.height, NSWidth(frame)); |
| 55 EXPECT_EQ(imageSize.height, NSHeight(frame)); | 56 EXPECT_EQ(imageSize.height, NSHeight(frame)); |
| 56 } | 57 } |
| 57 | 58 |
| 58 TEST_F(SpriteViewTest, StopAnimationOnMiniaturize) { | 59 TEST_F(SpriteViewTest, StopAnimationOnMiniaturize) { |
| 60 if (base::mac::IsOS10_10()) |
| 61 return; // Fails when swarmed. http://crbug.com/660582 |
| 59 EXPECT_TRUE([view_ isAnimating]); | 62 EXPECT_TRUE([view_ isAnimating]); |
| 60 | 63 |
| 61 [test_window() miniaturize:nil]; | 64 [test_window() miniaturize:nil]; |
| 62 EXPECT_FALSE([view_ isAnimating]); | 65 EXPECT_FALSE([view_ isAnimating]); |
| 63 | 66 |
| 64 [test_window() deminiaturize:nil]; | 67 [test_window() deminiaturize:nil]; |
| 65 EXPECT_TRUE([view_ isAnimating]); | 68 EXPECT_TRUE([view_ isAnimating]); |
| 66 } | 69 } |
| 67 | 70 |
| 68 TEST_F(SpriteViewTest, | 71 TEST_F(SpriteViewTest, |
| 69 StopAnimationOnRemoveFromSuperview) { | 72 StopAnimationOnRemoveFromSuperview) { |
| 70 EXPECT_TRUE([view_ isAnimating]); | 73 EXPECT_TRUE([view_ isAnimating]); |
| 71 | 74 |
| 72 [view_ removeFromSuperview]; | 75 [view_ removeFromSuperview]; |
| 73 EXPECT_FALSE([view_ isAnimating]); | 76 EXPECT_FALSE([view_ isAnimating]); |
| 74 | 77 |
| 75 [[test_window() contentView] addSubview:view_]; | 78 [[test_window() contentView] addSubview:view_]; |
| 76 EXPECT_TRUE([view_ isAnimating]); | 79 EXPECT_TRUE([view_ isAnimating]); |
| 77 } | 80 } |
| 78 | 81 |
| 79 } // namespace | 82 } // namespace |
| OLD | NEW |