| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/image_loader.h" | 5 #include "extensions/browser/image_loader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 loader.LoadImageAsync(extension.get(), | 153 loader.LoadImageAsync(extension.get(), |
| 154 image_resource, | 154 image_resource, |
| 155 max_size, | 155 max_size, |
| 156 base::Bind(&ImageLoaderTest::OnImageLoaded, | 156 base::Bind(&ImageLoaderTest::OnImageLoaded, |
| 157 base::Unretained(this))); | 157 base::Unretained(this))); |
| 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 ExtensionRegistry::Get(browser_context())->TriggerOnUnloaded( | 163 ExtensionRegistry::Get(browser_context()) |
| 164 extension.get(), UnloadedExtensionInfo::REASON_UNINSTALL); | 164 ->TriggerOnUnloaded(extension.get(), UnloadedExtensionReason::UNINSTALL); |
| 165 | 165 |
| 166 // Chuck the extension, that way if anyone tries to access it we should crash | 166 // Chuck the extension, that way if anyone tries to access it we should crash |
| 167 // or get valgrind errors. | 167 // or get valgrind errors. |
| 168 extension = NULL; | 168 extension = NULL; |
| 169 | 169 |
| 170 WaitForImageLoad(); | 170 WaitForImageLoad(); |
| 171 | 171 |
| 172 // Even though we deleted the extension, we should still get the image. | 172 // Even though we deleted the extension, we should still get the image. |
| 173 // We should still have gotten the image. | 173 // We should still have gotten the image. |
| 174 EXPECT_EQ(1, image_loaded_count()); | 174 EXPECT_EQ(1, image_loaded_count()); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; | 282 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; |
| 283 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; | 283 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; |
| 284 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width()); | 284 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width()); |
| 285 EXPECT_EQ(1.0f, img_rep1->scale()); | 285 EXPECT_EQ(1.0f, img_rep1->scale()); |
| 286 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width()); | 286 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width()); |
| 287 EXPECT_EQ(2.0f, img_rep2->scale()); | 287 EXPECT_EQ(2.0f, img_rep2->scale()); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace extensions | 290 } // namespace extensions |
| OLD | NEW |