Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / animatable_image_unittest.mm
blob310cbf31092c0af37b1370c57a47fb39278a14f7
1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/animatable_image.h"
8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h"
12 namespace {
14 class AnimatableImageTest : public CocoaTest {
15  public:
16   AnimatableImageTest() {
17     NSRect frame = NSMakeRect(0, 0, 500, 500);
18     NSImage* image = [NSImage imageNamed:NSImageNameComputer];
19     animation_ = [[AnimatableImage alloc] initWithImage:image
20                                          animationFrame:frame];
21   }
23   AnimatableImage* animation_;
26 TEST_F(AnimatableImageTest, BasicAnimation) {
27   [animation_ setStartFrame:CGRectMake(0, 0, 10, 10)];
28   [animation_ setEndFrame:CGRectMake(500, 500, 100, 100)];
29   [animation_ setStartOpacity:0.1];
30   [animation_ setEndOpacity:1.0];
31   [animation_ setDuration:0.5];
32   [animation_ startAnimation];
35 TEST_F(AnimatableImageTest, CancelAnimation) {
36   [animation_ setStartFrame:CGRectMake(0, 0, 10, 10)];
37   [animation_ setEndFrame:CGRectMake(500, 500, 100, 100)];
38   [animation_ setStartOpacity:0.1];
39   [animation_ setEndOpacity:1.0];
40   [animation_ setDuration:5.0];  // Long enough to be able to test cancelling.
41   [animation_ startAnimation];
42   [animation_ close];
45 }  // namespace