| 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(); |
| 131 } | 132 } |
| 132 | 133 |
| 133 void ExtensionTestNotificationObserver::Watch( | 134 void ExtensionTestNotificationObserver::Watch( |
| 134 int type, | 135 int type, |
| 135 const content::NotificationSource& source) { | 136 const content::NotificationSource& source) { |
| 136 CHECK(!observer_); | 137 CHECK(!observer_); |
| 137 observer_.reset(new content::WindowedNotificationObserver(type, source)); | 138 observer_.reset(new content::WindowedNotificationObserver(type, source)); |
| 138 registrar_.Add(this, type, source); | 139 registrar_.Add(this, type, source); |
| 139 } | 140 } |
| 140 | 141 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 condition_.Reset(); | 202 condition_.Reset(); |
| 202 quit_closure_.Reset(); | 203 quit_closure_.Reset(); |
| 203 } | 204 } |
| 204 | 205 |
| 205 void ExtensionTestNotificationObserver::MaybeQuit() { | 206 void ExtensionTestNotificationObserver::MaybeQuit() { |
| 206 if (condition_.Run()) | 207 if (condition_.Run()) |
| 207 quit_closure_.Run(); | 208 quit_closure_.Run(); |
| 208 } | 209 } |
| 209 | 210 |
| 210 } // namespace extensions | 211 } // namespace extensions |
| OLD | NEW |