| 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 #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 "chrome/browser/browser_thread.h" | 7 #include "chrome/browser/browser_thread.h" |
| 8 #include "chrome/browser/extensions/image_loading_tracker.h" | 8 #include "chrome/browser/extensions/image_loading_tracker.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" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 loader.LoadImage(extension.get(), | 153 loader.LoadImage(extension.get(), |
| 154 image_resource, | 154 image_resource, |
| 155 gfx::Size(Extension::EXTENSION_ICON_SMALLISH, | 155 gfx::Size(Extension::EXTENSION_ICON_SMALLISH, |
| 156 Extension::EXTENSION_ICON_SMALLISH), | 156 Extension::EXTENSION_ICON_SMALLISH), |
| 157 ImageLoadingTracker::CACHE); | 157 ImageLoadingTracker::CACHE); |
| 158 | 158 |
| 159 // The image isn't cached, so we should not have received notification. | 159 // The image isn't cached, so we should not have received notification. |
| 160 EXPECT_EQ(0, image_loaded_count()); | 160 EXPECT_EQ(0, image_loaded_count()); |
| 161 | 161 |
| 162 // Send out notification the extension was uninstalled. | 162 // Send out notification the extension was uninstalled. |
| 163 UnloadedExtensionInfo details(extension.get(), |
| 164 UnloadedExtensionInfo::UNINSTALL); |
| 163 NotificationService::current()->Notify( | 165 NotificationService::current()->Notify( |
| 164 NotificationType::EXTENSION_UNLOADED, | 166 NotificationType::EXTENSION_UNLOADED, |
| 165 NotificationService::AllSources(), | 167 NotificationService::AllSources(), |
| 166 Details<const Extension>(extension.get())); | 168 Details<UnloadedExtensionInfo>(&details)); |
| 167 | 169 |
| 168 // Chuck the extension, that way if anyone tries to access it we should crash | 170 // Chuck the extension, that way if anyone tries to access it we should crash |
| 169 // or get valgrind errors. | 171 // or get valgrind errors. |
| 170 extension = NULL; | 172 extension = NULL; |
| 171 | 173 |
| 172 WaitForImageLoad(); | 174 WaitForImageLoad(); |
| 173 | 175 |
| 174 // Even though we deleted the extension, we should still get the image. | 176 // Even though we deleted the extension, we should still get the image. |
| 175 // We should still have gotten the image. | 177 // We should still have gotten the image. |
| 176 EXPECT_EQ(1, image_loaded_count()); | 178 EXPECT_EQ(1, image_loaded_count()); |
| 177 | 179 |
| 178 // Check that the image was loaded. | 180 // Check that the image was loaded. |
| 179 EXPECT_EQ(Extension::EXTENSION_ICON_SMALLISH, image_.width()); | 181 EXPECT_EQ(Extension::EXTENSION_ICON_SMALLISH, image_.width()); |
| 180 } | 182 } |
| OLD | NEW |