| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/json/json_file_value_serializer.h" | 5 #include "base/json/json_file_value_serializer.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/extension_icon_manager.h" | 9 #include "chrome/browser/extensions/extension_icon_manager.h" |
| 10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Now re-load the icon - we should get the same result bitmap (and not the | 132 // Now re-load the icon - we should get the same result bitmap (and not the |
| 133 // default icon). | 133 // default icon). |
| 134 icon_manager.LoadIcon(profile.get(), extension.get()); | 134 icon_manager.LoadIcon(profile.get(), extension.get()); |
| 135 WaitForImageLoad(); | 135 WaitForImageLoad(); |
| 136 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); | 136 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); |
| 137 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); | 137 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); |
| 138 | 138 |
| 139 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); | 139 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 #if defined(FILE_MANAGER_EXTENSION) | 142 #if defined(OS_CHROMEOS) |
| 143 // Tests loading an icon for a component extension. | 143 // Tests loading an icon for a component extension. |
| 144 TEST_F(ExtensionIconManagerTest, LoadComponentExtensionResource) { | 144 TEST_F(ExtensionIconManagerTest, LoadComponentExtensionResource) { |
| 145 scoped_ptr<Profile> profile(new TestingProfile()); | 145 scoped_ptr<Profile> profile(new TestingProfile()); |
| 146 SkBitmap default_icon = GetDefaultIcon(); | 146 SkBitmap default_icon = GetDefaultIcon(); |
| 147 | 147 |
| 148 base::FilePath test_dir; | 148 base::FilePath test_dir; |
| 149 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 149 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
| 150 base::FilePath manifest_path = test_dir.AppendASCII( | 150 base::FilePath manifest_path = test_dir.AppendASCII( |
| 151 "extensions/file_manager/app.json"); | 151 "extensions/file_manager/app.json"); |
| 152 | 152 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 174 // Now re-load the icon - we should get the same result bitmap (and not the | 174 // Now re-load the icon - we should get the same result bitmap (and not the |
| 175 // default icon). | 175 // default icon). |
| 176 icon_manager.LoadIcon(profile.get(), extension.get()); | 176 icon_manager.LoadIcon(profile.get(), extension.get()); |
| 177 WaitForImageLoad(); | 177 WaitForImageLoad(); |
| 178 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); | 178 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); |
| 179 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); | 179 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); |
| 180 | 180 |
| 181 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); | 181 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); |
| 182 } | 182 } |
| 183 #endif | 183 #endif |
| OLD | NEW |