| 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/nsimage_cache_mac.h" |
| 9 #include "base/path_service.h" | 10 #include "base/path_service.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 #include "testing/platform_test.h" |
| 14 | 14 |
| 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. |
| 17 |
| 15 namespace { | 18 namespace { |
| 16 | 19 |
| 17 class NSImageCacheTest : public PlatformTest { | 20 class NSImageCacheTest : public PlatformTest { |
| 18 public: | 21 public: |
| 19 NSImageCacheTest() { | 22 NSImageCacheTest() { |
| 20 // Look in the Chromium app bundle for resources. | 23 // Look in the Chromium app bundle for resources. |
| 21 FilePath path; | 24 FilePath path; |
| 22 PathService::Get(base::DIR_EXE, &path); | 25 PathService::Get(base::DIR_EXE, &path); |
| 23 path = path.AppendASCII(MAC_BROWSER_APP_NAME); | 26 path = path.AppendASCII(MAC_BROWSER_APP_NAME); |
| 24 mac_util::SetOverrideAppBundlePath(path); | 27 mac_util::SetOverrideAppBundlePath(path); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 47 TEST_F(NSImageCacheTest, LookupFoundAndClear) { | 50 TEST_F(NSImageCacheTest, LookupFoundAndClear) { |
| 48 NSImage *first = nsimage_cache::ImageNamed(@"back_Template.pdf"); | 51 NSImage *first = nsimage_cache::ImageNamed(@"back_Template.pdf"); |
| 49 EXPECT_TRUE(first != nil) | 52 EXPECT_TRUE(first != nil) |
| 50 << "Failed to find the toolbar image?"; | 53 << "Failed to find the toolbar image?"; |
| 51 nsimage_cache::Clear(); | 54 nsimage_cache::Clear(); |
| 52 EXPECT_NE(first, nsimage_cache::ImageNamed(@"back_Template.pdf")) | 55 EXPECT_NE(first, nsimage_cache::ImageNamed(@"back_Template.pdf")) |
| 53 << "how'd we get the same image after a cache clear?"; | 56 << "how'd we get the same image after a cache clear?"; |
| 54 } | 57 } |
| 55 | 58 |
| 56 } // namespace | 59 } // namespace |
| OLD | NEW |