| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/extensions/extension_test_notification_observer.h" | 5 #include "chrome/browser/extensions/extension_test_notification_observer.h" |
| 6 | 6 |
| 7 #include "base/callback_list.h" | 7 #include "base/callback_list.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 notification_set.Add(content::NOTIFICATION_WEB_CONTENTS_DESTROYED); | 178 notification_set.Add(content::NOTIFICATION_WEB_CONTENTS_DESTROYED); |
| 179 notification_set.Add(content::NOTIFICATION_LOAD_STOP); | 179 notification_set.Add(content::NOTIFICATION_LOAD_STOP); |
| 180 WaitForCondition( | 180 WaitForCondition( |
| 181 base::Bind(&HaveAllExtensionRenderViewHostsFinishedLoading, manager), | 181 base::Bind(&HaveAllExtensionRenderViewHostsFinishedLoading, manager), |
| 182 ¬ification_set); | 182 ¬ification_set); |
| 183 return true; | 183 return true; |
| 184 } | 184 } |
| 185 | 185 |
| 186 bool ExtensionTestNotificationObserver::WaitForExtensionInstall() { | 186 bool ExtensionTestNotificationObserver::WaitForExtensionInstall() { |
| 187 int before = extension_installs_observed_; | 187 int before = extension_installs_observed_; |
| 188 WaitForNotification(chrome::NOTIFICATION_EXTENSION_INSTALLED); | 188 WaitForNotification(chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED); |
| 189 return extension_installs_observed_ == (before + 1); | 189 return extension_installs_observed_ == (before + 1); |
| 190 } | 190 } |
| 191 | 191 |
| 192 bool ExtensionTestNotificationObserver::WaitForExtensionInstallError() { | 192 bool ExtensionTestNotificationObserver::WaitForExtensionInstallError() { |
| 193 int before = extension_installs_observed_; | 193 int before = extension_installs_observed_; |
| 194 content::WindowedNotificationObserver( | 194 content::WindowedNotificationObserver( |
| 195 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 195 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
| 196 content::NotificationService::AllSources()).Wait(); | 196 content::NotificationService::AllSources()).Wait(); |
| 197 return extension_installs_observed_ == before; | 197 return extension_installs_observed_ == before; |
| 198 } | 198 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 const Extension* extension = | 265 const Extension* extension = |
| 266 content::Details<const Extension>(details).ptr(); | 266 content::Details<const Extension>(details).ptr(); |
| 267 if (extension) | 267 if (extension) |
| 268 last_loaded_extension_id_ = extension->id(); | 268 last_loaded_extension_id_ = extension->id(); |
| 269 else | 269 else |
| 270 last_loaded_extension_id_.clear(); | 270 last_loaded_extension_id_.clear(); |
| 271 } | 271 } |
| 272 ++crx_installers_done_observed_; | 272 ++crx_installers_done_observed_; |
| 273 break; | 273 break; |
| 274 | 274 |
| 275 case chrome::NOTIFICATION_EXTENSION_INSTALLED: | 275 case chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED: |
| 276 VLOG(1) << "Got EXTENSION_INSTALLED notification."; | 276 VLOG(1) << "Got EXTENSION_INSTALLED notification."; |
| 277 ++extension_installs_observed_; | 277 ++extension_installs_observed_; |
| 278 break; | 278 break; |
| 279 | 279 |
| 280 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: | 280 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: |
| 281 VLOG(1) << "Got EXTENSION_LOAD_ERROR notification."; | 281 VLOG(1) << "Got EXTENSION_LOAD_ERROR notification."; |
| 282 ++extension_load_errors_observed_; | 282 ++extension_load_errors_observed_; |
| 283 break; | 283 break; |
| 284 | 284 |
| 285 default: | 285 default: |
| 286 NOTREACHED(); | 286 NOTREACHED(); |
| 287 break; | 287 break; |
| 288 } | 288 } |
| 289 } | 289 } |
| OLD | NEW |