OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "chrome/browser/cocoa/nsimage_cache.h" | 10 #include "chrome/browser/cocoa/nsimage_cache.h" |
11 #include "chrome/common/mac_app_names.h" | 11 #include "chrome/common/mac_app_names.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/platform_test.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 class NSImageCacheTest : public testing::Test { | 17 class NSImageCacheTest : public PlatformTest { |
17 public: | 18 public: |
18 NSImageCacheTest() { | 19 NSImageCacheTest() { |
19 // Look in the Chromium app bundle for resources. | 20 // Look in the Chromium app bundle for resources. |
20 FilePath path; | 21 FilePath path; |
21 PathService::Get(base::DIR_EXE, &path); | 22 PathService::Get(base::DIR_EXE, &path); |
22 path = path.AppendASCII(MAC_BROWSER_APP_NAME); | 23 path = path.AppendASCII(MAC_BROWSER_APP_NAME); |
23 mac_util::SetOverrideAppBundlePath(path); | 24 mac_util::SetOverrideAppBundlePath(path); |
24 } | 25 } |
25 virtual ~NSImageCacheTest() { | 26 virtual ~NSImageCacheTest() { |
26 mac_util::SetOverrideAppBundle(nil); | 27 mac_util::SetOverrideAppBundle(nil); |
(...skipping 19 matching lines...) Expand all Loading... |
46 TEST_F(NSImageCacheTest, LookupFoundAndClear) { | 47 TEST_F(NSImageCacheTest, LookupFoundAndClear) { |
47 NSImage *first = nsimage_cache::ImageNamed(@"back_Template.pdf"); | 48 NSImage *first = nsimage_cache::ImageNamed(@"back_Template.pdf"); |
48 EXPECT_TRUE(first != nil) | 49 EXPECT_TRUE(first != nil) |
49 << "Failed to find the toolbar image?"; | 50 << "Failed to find the toolbar image?"; |
50 nsimage_cache::Clear(); | 51 nsimage_cache::Clear(); |
51 EXPECT_NE(first, nsimage_cache::ImageNamed(@"back_Template.pdf")) | 52 EXPECT_NE(first, nsimage_cache::ImageNamed(@"back_Template.pdf")) |
52 << "how'd we get the same image after a cache clear?"; | 53 << "how'd we get the same image after a cache clear?"; |
53 } | 54 } |
54 | 55 |
55 } // namespace | 56 } // namespace |
OLD | NEW |