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

Side by Side Diff: chrome/browser/ui/cocoa/animatable_image_unittest.mm

Issue 5961007: Move nsimage_cache from base to app/mac. Use the app::mac namespace. Update c... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #import "base/nsimage_cache_mac.h" 7 #import "app/mac/nsimage_cache.h"
8 #import "chrome/browser/ui/cocoa/animatable_image.h" 8 #import "chrome/browser/ui/cocoa/animatable_image.h"
9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 11 #include "testing/platform_test.h"
12 12
13 namespace { 13 namespace {
14 14
15 class AnimatableImageTest : public CocoaTest { 15 class AnimatableImageTest : public CocoaTest {
16 public: 16 public:
17 AnimatableImageTest() { 17 AnimatableImageTest() {
18 NSRect frame = NSMakeRect(0, 0, 500, 500); 18 NSRect frame = NSMakeRect(0, 0, 500, 500);
19 NSImage* image = nsimage_cache::ImageNamed(@"forward_Template.pdf"); 19 NSImage* image = app::mac::GetCachedImageWithName(@"forward_Template.pdf");
20 animation_ = [[AnimatableImage alloc] initWithImage:image 20 animation_ = [[AnimatableImage alloc] initWithImage:image
21 animationFrame:frame]; 21 animationFrame:frame];
22 } 22 }
23 23
24 AnimatableImage* animation_; 24 AnimatableImage* animation_;
25 }; 25 };
26 26
27 TEST_F(AnimatableImageTest, BasicAnimation) { 27 TEST_F(AnimatableImageTest, BasicAnimation) {
28 [animation_ setStartFrame:CGRectMake(0, 0, 10, 10)]; 28 [animation_ setStartFrame:CGRectMake(0, 0, 10, 10)];
29 [animation_ setEndFrame:CGRectMake(500, 500, 100, 100)]; 29 [animation_ setEndFrame:CGRectMake(500, 500, 100, 100)];
30 [animation_ setStartOpacity:0.1]; 30 [animation_ setStartOpacity:0.1];
31 [animation_ setEndOpacity:1.0]; 31 [animation_ setEndOpacity:1.0];
32 [animation_ setDuration:0.5]; 32 [animation_ setDuration:0.5];
33 [animation_ startAnimation]; 33 [animation_ startAnimation];
34 } 34 }
35 35
36 TEST_F(AnimatableImageTest, CancelAnimation) { 36 TEST_F(AnimatableImageTest, CancelAnimation) {
37 [animation_ setStartFrame:CGRectMake(0, 0, 10, 10)]; 37 [animation_ setStartFrame:CGRectMake(0, 0, 10, 10)];
38 [animation_ setEndFrame:CGRectMake(500, 500, 100, 100)]; 38 [animation_ setEndFrame:CGRectMake(500, 500, 100, 100)];
39 [animation_ setStartOpacity:0.1]; 39 [animation_ setStartOpacity:0.1];
40 [animation_ setEndOpacity:1.0]; 40 [animation_ setEndOpacity:1.0];
41 [animation_ setDuration:5.0]; // Long enough to be able to test cancelling. 41 [animation_ setDuration:5.0]; // Long enough to be able to test cancelling.
42 [animation_ startAnimation]; 42 [animation_ startAnimation];
43 [animation_ close]; 43 [animation_ close];
44 } 44 }
45 45
46 } // namespace 46 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698