| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/extensions/extension_icon_manager.h" | 8 #include "chrome/browser/extensions/extension_icon_manager.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| 11 #include "chrome/common/extensions/extension_resource.h" | 11 #include "chrome/common/extensions/extension_resource.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 FilePath manifest_path = test_dir.AppendASCII( | 104 FilePath manifest_path = test_dir.AppendASCII( |
| 105 "extensions/image_loading_tracker/app.json"); | 105 "extensions/image_loading_tracker/app.json"); |
| 106 | 106 |
| 107 JSONFileValueSerializer serializer(manifest_path); | 107 JSONFileValueSerializer serializer(manifest_path); |
| 108 scoped_ptr<DictionaryValue> manifest( | 108 scoped_ptr<DictionaryValue> manifest( |
| 109 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, NULL))); | 109 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, NULL))); |
| 110 ASSERT_TRUE(manifest.get() != NULL); | 110 ASSERT_TRUE(manifest.get() != NULL); |
| 111 | 111 |
| 112 scoped_refptr<Extension> extension(Extension::Create( | 112 scoped_refptr<Extension> extension(Extension::Create( |
| 113 manifest_path.DirName(), Extension::INVALID, *manifest.get(), | 113 manifest_path.DirName(), Extension::INVALID, *manifest.get(), |
| 114 false, true, NULL)); | 114 Extension::STRICT_ERROR_CHECKS, NULL)); |
| 115 ASSERT_TRUE(extension.get()); | 115 ASSERT_TRUE(extension.get()); |
| 116 TestIconManager icon_manager(this); | 116 TestIconManager icon_manager(this); |
| 117 | 117 |
| 118 // Load the icon and grab the bitmap. | 118 // Load the icon and grab the bitmap. |
| 119 icon_manager.LoadIcon(extension.get()); | 119 icon_manager.LoadIcon(extension.get()); |
| 120 WaitForImageLoad(); | 120 WaitForImageLoad(); |
| 121 SkBitmap first_icon = icon_manager.GetIcon(extension->id()); | 121 SkBitmap first_icon = icon_manager.GetIcon(extension->id()); |
| 122 EXPECT_FALSE(gfx::BitmapsAreEqual(first_icon, default_icon)); | 122 EXPECT_FALSE(gfx::BitmapsAreEqual(first_icon, default_icon)); |
| 123 | 123 |
| 124 // Remove the icon from the manager. | 124 // Remove the icon from the manager. |
| 125 icon_manager.RemoveIcon(extension->id()); | 125 icon_manager.RemoveIcon(extension->id()); |
| 126 | 126 |
| 127 // Now re-load the icon - we should get the same result bitmap (and not the | 127 // Now re-load the icon - we should get the same result bitmap (and not the |
| 128 // default icon). | 128 // default icon). |
| 129 icon_manager.LoadIcon(extension.get()); | 129 icon_manager.LoadIcon(extension.get()); |
| 130 WaitForImageLoad(); | 130 WaitForImageLoad(); |
| 131 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); | 131 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); |
| 132 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); | 132 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); |
| 133 | 133 |
| 134 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); | 134 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); |
| 135 } | 135 } |
| OLD | NEW |