| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test/extension_test_notification_observer.h" | 5 #include "extensions/test/extension_test_notification_observer.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_context.h" | 7 #include "content/public/browser/browser_context.h" |
| 8 #include "content/public/browser/notification_details.h" | 8 #include "content/public/browser/notification_details.h" |
| 9 #include "content/public/browser/notification_registrar.h" | 9 #include "content/public/browser/notification_registrar.h" |
| 10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 content::WindowedNotificationObserver( | 120 content::WindowedNotificationObserver( |
| 121 NOTIFICATION_EXTENSION_PROCESS_TERMINATED, | 121 NOTIFICATION_EXTENSION_PROCESS_TERMINATED, |
| 122 content::NotificationService::AllSources()) | 122 content::NotificationService::AllSources()) |
| 123 .Wait(); | 123 .Wait(); |
| 124 return (GetNonTerminatedExtensions(extension_id, context_) == NULL); | 124 return (GetNonTerminatedExtensions(extension_id, context_) == NULL); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool ExtensionTestNotificationObserver::WaitForCrxInstallerDone() { | 127 bool ExtensionTestNotificationObserver::WaitForCrxInstallerDone() { |
| 128 int before = crx_installers_done_observed_; | 128 int before = crx_installers_done_observed_; |
| 129 WaitForNotification(NOTIFICATION_CRX_INSTALLER_DONE); | 129 WaitForNotification(NOTIFICATION_CRX_INSTALLER_DONE); |
| 130 return crx_installers_done_observed_ == before + 1 && | 130 return crx_installers_done_observed_ == before + 1; |
| 131 !last_loaded_extension_id_.empty(); | |
| 132 } | 131 } |
| 133 | 132 |
| 134 void ExtensionTestNotificationObserver::Watch( | 133 void ExtensionTestNotificationObserver::Watch( |
| 135 int type, | 134 int type, |
| 136 const content::NotificationSource& source) { | 135 const content::NotificationSource& source) { |
| 137 CHECK(!observer_); | 136 CHECK(!observer_); |
| 138 observer_.reset(new content::WindowedNotificationObserver(type, source)); | 137 observer_.reset(new content::WindowedNotificationObserver(type, source)); |
| 139 registrar_.Add(this, type, source); | 138 registrar_.Add(this, type, source); |
| 140 } | 139 } |
| 141 | 140 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 condition_.Reset(); | 201 condition_.Reset(); |
| 203 quit_closure_.Reset(); | 202 quit_closure_.Reset(); |
| 204 } | 203 } |
| 205 | 204 |
| 206 void ExtensionTestNotificationObserver::MaybeQuit() { | 205 void ExtensionTestNotificationObserver::MaybeQuit() { |
| 207 if (condition_.Run()) | 206 if (condition_.Run()) |
| 208 quit_closure_.Run(); | 207 quit_closure_.Run(); |
| 209 } | 208 } |
| 210 | 209 |
| 211 } // namespace extensions | 210 } // namespace extensions |
| OLD | NEW |