OLD | NEW |
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 #include "app/mac/nsimage_cache.h" | 7 #include "app/mac/nsimage_cache.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "chrome/common/chrome_constants.h" | 11 #include "chrome/common/chrome_constants.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
14 | 14 |
15 // This tests nsimage_cache, which lives in base/. The unit test is in | 15 // This tests nsimage_cache, which lives in base/. The unit test is in |
16 // chrome/ because it depends on having a built-up Chrome present. | 16 // chrome/ because it depends on having a built-up Chrome present. |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 class NSImageCacheTest : public PlatformTest { | 20 class NSImageCacheTest : public PlatformTest { |
21 public: | 21 public: |
22 NSImageCacheTest() { | 22 NSImageCacheTest() { |
23 // Look in the framework bundle for resources. | 23 // Look in the framework bundle for resources. |
24 FilePath path; | 24 FilePath path; |
25 PathService::Get(base::DIR_EXE, &path); | 25 PathService::Get(base::DIR_EXE, &path); |
26 path = path.Append(chrome::kFrameworkName); | 26 path = path.Append(chrome::kFrameworkName); |
27 mac_util::SetOverrideAppBundlePath(path); | 27 base::mac::SetOverrideAppBundlePath(path); |
28 } | 28 } |
29 virtual ~NSImageCacheTest() { | 29 virtual ~NSImageCacheTest() { |
30 mac_util::SetOverrideAppBundle(nil); | 30 base::mac::SetOverrideAppBundle(nil); |
31 } | 31 } |
32 }; | 32 }; |
33 | 33 |
34 TEST_F(NSImageCacheTest, LookupFound) { | 34 TEST_F(NSImageCacheTest, LookupFound) { |
35 EXPECT_TRUE(app::mac::GetCachedImageWithName(@"back_Template.pdf") != nil) | 35 EXPECT_TRUE(app::mac::GetCachedImageWithName(@"back_Template.pdf") != nil) |
36 << "Failed to find the toolbar image?"; | 36 << "Failed to find the toolbar image?"; |
37 } | 37 } |
38 | 38 |
39 TEST_F(NSImageCacheTest, LookupCached) { | 39 TEST_F(NSImageCacheTest, LookupCached) { |
40 EXPECT_EQ(app::mac::GetCachedImageWithName(@"back_Template.pdf"), | 40 EXPECT_EQ(app::mac::GetCachedImageWithName(@"back_Template.pdf"), |
(...skipping 27 matching lines...) Expand all Loading... |
68 EXPECT_TRUE([templateImage isTemplate] == YES) | 68 EXPECT_TRUE([templateImage isTemplate] == YES) |
69 << "Image ending in 'Template' should be marked as being a template"; | 69 << "Image ending in 'Template' should be marked as being a template"; |
70 NSImage *nonTemplateImage = | 70 NSImage *nonTemplateImage = |
71 app::mac::GetCachedImageWithName(@"aliasCursor.png"); | 71 app::mac::GetCachedImageWithName(@"aliasCursor.png"); |
72 EXPECT_FALSE([nonTemplateImage isTemplate] == YES) | 72 EXPECT_FALSE([nonTemplateImage isTemplate] == YES) |
73 << "Image not ending in 'Template' should not be marked as being a " | 73 << "Image not ending in 'Template' should not be marked as being a " |
74 "template"; | 74 "template"; |
75 } | 75 } |
76 | 76 |
77 } // namespace | 77 } // namespace |
OLD | NEW |