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