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

Unified Diff: chrome/browser/themes/theme_service_unittest.cc

Issue 965233002: Remove deprecated extension notification from theme_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to private Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/themes/theme_service_factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/themes/theme_service_unittest.cc
diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc
index 82cd20de5cc0f09f9cb1b96d9aa631d0b8c514d3..c1eb7cf0bdca8c0b7c590b97ef9f32ab853d7f5f 100644
--- a/chrome/browser/themes/theme_service_unittest.cc
+++ b/chrome/browser/themes/theme_service_unittest.cc
@@ -19,6 +19,7 @@
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_registry.h"
+#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -50,14 +51,10 @@ class ThemeServiceTest : public extensions::ExtensionServiceTestBase {
scoped_refptr<extensions::UnpackedInstaller> installer(
extensions::UnpackedInstaller::Create(service_));
- content::WindowedNotificationObserver observer(
- extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
- content::Source<Profile>(profile_.get()));
+ extensions::TestExtensionRegistryObserver observer(
+ ExtensionRegistry::Get(profile()));
installer->Load(temp_dir);
- observer.Wait();
-
- std::string extension_id =
- content::Details<extensions::Extension>(observer.details())->id();
+ std::string extension_id = observer.WaitForExtensionLoaded()->id();
// Let the ThemeService finish creating the theme pack.
base::MessageLoop::current()->RunUntilIdle();
@@ -67,20 +64,23 @@ class ThemeServiceTest : public extensions::ExtensionServiceTestBase {
// Update the theme with |extension_id|.
void UpdateUnpackedTheme(const std::string& extension_id) {
- int updated_notification =
- service_->IsExtensionEnabled(extension_id)
- ? extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED
- : extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED;
-
const base::FilePath& path =
service_->GetInstalledExtension(extension_id)->path();
scoped_refptr<extensions::UnpackedInstaller> installer(
extensions::UnpackedInstaller::Create(service_));
- content::WindowedNotificationObserver observer(updated_notification,
- content::Source<Profile>(profile_.get()));
- installer->Load(path);
- observer.Wait();
+ if (service_->IsExtensionEnabled(extension_id)) {
+ extensions::TestExtensionRegistryObserver observer(
+ ExtensionRegistry::Get(profile()));
+ installer->Load(path);
+ observer.WaitForExtensionLoaded();
+ } else {
+ content::WindowedNotificationObserver observer(
+ extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
+ content::Source<Profile>(profile_.get()));
+ installer->Load(path);
+ observer.Wait();
+ }
// Let the ThemeService finish creating the theme pack.
base::MessageLoop::current()->RunUntilIdle();
« no previous file with comments | « chrome/browser/themes/theme_service_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698