Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: extensions/browser/image_loader_unittest.cc

Issue 346193002: Use ExtensionRegistry in EventRouter and ApiResourceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 12 #include "chrome/browser/chrome_notification_types.h"
Devlin 2014/06/25 19:59:54 nit: We should be able to remove this and notifica
limasdf 2014/07/20 06:35:50 Done. Handled in seperate CL :)
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 #include "content/public/test/test_browser_context.h"
15 #include "content/public/test/test_browser_thread.h" 16 #include "content/public/test/test_browser_thread.h"
16 #include "extensions/browser/component_extension_resource_manager.h" 17 #include "extensions/browser/component_extension_resource_manager.h"
18 #include "extensions/browser/extension_registry.h"
17 #include "extensions/browser/extensions_browser_client.h" 19 #include "extensions/browser/extensions_browser_client.h"
18 #include "extensions/common/constants.h" 20 #include "extensions/common/constants.h"
19 #include "extensions/common/extension.h" 21 #include "extensions/common/extension.h"
20 #include "extensions/common/extension_icon_set.h" 22 #include "extensions/common/extension_icon_set.h"
21 #include "extensions/common/extension_resource.h" 23 #include "extensions/common/extension_resource.h"
22 #include "extensions/common/manifest.h" 24 #include "extensions/common/manifest.h"
23 #include "extensions/common/manifest_handlers/icons_handler.h" 25 #include "extensions/common/manifest_handlers/icons_handler.h"
24 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
25 #include "third_party/skia/include/core/SkBitmap.h" 27 #include "third_party/skia/include/core/SkBitmap.h"
26 #include "ui/gfx/image/image.h" 28 #include "ui/gfx/image/image.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 loader.LoadImageAsync(extension.get(), 181 loader.LoadImageAsync(extension.get(),
180 image_resource, 182 image_resource,
181 max_size, 183 max_size,
182 base::Bind(&ImageLoaderTest::OnImageLoaded, 184 base::Bind(&ImageLoaderTest::OnImageLoaded,
183 base::Unretained(this))); 185 base::Unretained(this)));
184 186
185 // The image isn't cached, so we should not have received notification. 187 // The image isn't cached, so we should not have received notification.
186 EXPECT_EQ(0, image_loaded_count()); 188 EXPECT_EQ(0, image_loaded_count());
187 189
188 // Send out notification the extension was uninstalled. 190 // Send out notification the extension was uninstalled.
189 UnloadedExtensionInfo details(extension.get(), 191 scoped_ptr<content::TestBrowserContext> browser_context(
190 UnloadedExtensionInfo::REASON_UNINSTALL); 192 new content::TestBrowserContext());
191 content::NotificationService::current()->Notify( 193 extensions::ExtensionRegistry::Get(browser_context.get())->TriggerOnUnloaded(
192 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 194 extension.get(), UnloadedExtensionInfo::REASON_UNINSTALL);
193 content::NotificationService::AllSources(),
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.
203 // We should still have gotten the image. 203 // We should still have gotten the image.
204 EXPECT_EQ(1, image_loaded_count()); 204 EXPECT_EQ(1, image_loaded_count());
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« extensions/browser/event_router.cc ('K') | « extensions/browser/extension_registry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698