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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "chrome/browser/chrome_notification_types.h" | |
13 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
14 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
15 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread.h" |
16 #include "extensions/browser/component_extension_resource_manager.h" | 15 #include "extensions/browser/component_extension_resource_manager.h" |
17 #include "extensions/browser/extensions_browser_client.h" | 16 #include "extensions/browser/extensions_browser_client.h" |
| 17 #include "extensions/browser/notification_types.h" |
18 #include "extensions/common/constants.h" | 18 #include "extensions/common/constants.h" |
19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
20 #include "extensions/common/extension_icon_set.h" | 20 #include "extensions/common/extension_icon_set.h" |
21 #include "extensions/common/extension_resource.h" | 21 #include "extensions/common/extension_resource.h" |
22 #include "extensions/common/manifest.h" | 22 #include "extensions/common/manifest.h" |
23 #include "extensions/common/manifest_handlers/icons_handler.h" | 23 #include "extensions/common/manifest_handlers/icons_handler.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "third_party/skia/include/core/SkBitmap.h" | 25 #include "third_party/skia/include/core/SkBitmap.h" |
26 #include "ui/gfx/image/image.h" | 26 #include "ui/gfx/image/image.h" |
27 #include "ui/gfx/image/image_family.h" | 27 #include "ui/gfx/image/image_family.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 base::Bind(&ImageLoaderTest::OnImageLoaded, | 182 base::Bind(&ImageLoaderTest::OnImageLoaded, |
183 base::Unretained(this))); | 183 base::Unretained(this))); |
184 | 184 |
185 // The image isn't cached, so we should not have received notification. | 185 // The image isn't cached, so we should not have received notification. |
186 EXPECT_EQ(0, image_loaded_count()); | 186 EXPECT_EQ(0, image_loaded_count()); |
187 | 187 |
188 // Send out notification the extension was uninstalled. | 188 // Send out notification the extension was uninstalled. |
189 UnloadedExtensionInfo details(extension.get(), | 189 UnloadedExtensionInfo details(extension.get(), |
190 UnloadedExtensionInfo::REASON_UNINSTALL); | 190 UnloadedExtensionInfo::REASON_UNINSTALL); |
191 content::NotificationService::current()->Notify( | 191 content::NotificationService::current()->Notify( |
192 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 192 extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
193 content::NotificationService::AllSources(), | 193 content::NotificationService::AllSources(), |
194 content::Details<UnloadedExtensionInfo>(&details)); | 194 content::Details<UnloadedExtensionInfo>(&details)); |
195 | 195 |
196 // Chuck the extension, that way if anyone tries to access it we should crash | 196 // Chuck the extension, that way if anyone tries to access it we should crash |
197 // or get valgrind errors. | 197 // or get valgrind errors. |
198 extension = NULL; | 198 extension = NULL; |
199 | 199 |
200 WaitForImageLoad(); | 200 WaitForImageLoad(); |
201 | 201 |
202 // Even though we deleted the extension, we should still get the image. | 202 // Even though we deleted the extension, we should still get the image. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 #if defined(OS_CHROMEOS) | 343 #if defined(OS_CHROMEOS) |
344 int resource_id; | 344 int resource_id; |
345 ASSERT_TRUE(resource_manager->IsComponentExtensionResource( | 345 ASSERT_TRUE(resource_manager->IsComponentExtensionResource( |
346 extension->path(), | 346 extension->path(), |
347 resource.relative_path(), | 347 resource.relative_path(), |
348 &resource_id)); | 348 &resource_id)); |
349 ASSERT_EQ(IDR_FILE_MANAGER_ICON_16, resource_id); | 349 ASSERT_EQ(IDR_FILE_MANAGER_ICON_16, resource_id); |
350 #endif | 350 #endif |
351 } | 351 } |
OLD | NEW |