| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/test/integration/apps_helper.h" | 5 #include "chrome/browser/sync/test/integration/apps_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // extensions lists. | 142 // extensions lists. |
| 143 class AppsMatchChecker : public StatusChangeChecker, | 143 class AppsMatchChecker : public StatusChangeChecker, |
| 144 public extensions::ExtensionRegistryObserver, | 144 public extensions::ExtensionRegistryObserver, |
| 145 public extensions::ExtensionPrefsObserver, | 145 public extensions::ExtensionPrefsObserver, |
| 146 public content::NotificationObserver { | 146 public content::NotificationObserver { |
| 147 public: | 147 public: |
| 148 explicit AppsMatchChecker(const std::vector<Profile*>& profiles); | 148 explicit AppsMatchChecker(const std::vector<Profile*>& profiles); |
| 149 virtual ~AppsMatchChecker(); | 149 virtual ~AppsMatchChecker(); |
| 150 | 150 |
| 151 // StatusChangeChecker implementation. | 151 // StatusChangeChecker implementation. |
| 152 virtual std::string GetDebugMessage() const OVERRIDE; | 152 virtual std::string GetDebugMessage() const override; |
| 153 virtual bool IsExitConditionSatisfied() OVERRIDE; | 153 virtual bool IsExitConditionSatisfied() override; |
| 154 | 154 |
| 155 // extensions::ExtensionRegistryObserver implementation. | 155 // extensions::ExtensionRegistryObserver implementation. |
| 156 virtual void OnExtensionLoaded( | 156 virtual void OnExtensionLoaded( |
| 157 content::BrowserContext* context, | 157 content::BrowserContext* context, |
| 158 const extensions::Extension* extension) OVERRIDE; | 158 const extensions::Extension* extension) override; |
| 159 virtual void OnExtensionUnloaded( | 159 virtual void OnExtensionUnloaded( |
| 160 content::BrowserContext* context, | 160 content::BrowserContext* context, |
| 161 const extensions::Extension* extenion, | 161 const extensions::Extension* extenion, |
| 162 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; | 162 extensions::UnloadedExtensionInfo::Reason reason) override; |
| 163 virtual void OnExtensionInstalled(content::BrowserContext* browser_context, | 163 virtual void OnExtensionInstalled(content::BrowserContext* browser_context, |
| 164 const extensions::Extension* extension, | 164 const extensions::Extension* extension, |
| 165 bool is_update) OVERRIDE; | 165 bool is_update) override; |
| 166 virtual void OnExtensionUninstalled( | 166 virtual void OnExtensionUninstalled( |
| 167 content::BrowserContext* browser_context, | 167 content::BrowserContext* browser_context, |
| 168 const extensions::Extension* extension, | 168 const extensions::Extension* extension, |
| 169 extensions::UninstallReason reason) OVERRIDE; | 169 extensions::UninstallReason reason) override; |
| 170 | 170 |
| 171 // extensions::ExtensionPrefsObserver implementation. | 171 // extensions::ExtensionPrefsObserver implementation. |
| 172 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id, | 172 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id, |
| 173 int disabled_reasons) OVERRIDE; | 173 int disabled_reasons) override; |
| 174 virtual void OnExtensionRegistered(const std::string& extension_id, | 174 virtual void OnExtensionRegistered(const std::string& extension_id, |
| 175 const base::Time& install_time, | 175 const base::Time& install_time, |
| 176 bool is_enabled) OVERRIDE; | 176 bool is_enabled) override; |
| 177 virtual void OnExtensionPrefsLoaded( | 177 virtual void OnExtensionPrefsLoaded( |
| 178 const std::string& extension_id, | 178 const std::string& extension_id, |
| 179 const extensions::ExtensionPrefs* prefs) OVERRIDE; | 179 const extensions::ExtensionPrefs* prefs) override; |
| 180 virtual void OnExtensionPrefsDeleted( | 180 virtual void OnExtensionPrefsDeleted( |
| 181 const std::string& extension_id) OVERRIDE; | 181 const std::string& extension_id) override; |
| 182 virtual void OnExtensionStateChanged(const std::string& extension_id, | 182 virtual void OnExtensionStateChanged(const std::string& extension_id, |
| 183 bool state) OVERRIDE; | 183 bool state) override; |
| 184 | 184 |
| 185 // Implementation of content::NotificationObserver. | 185 // Implementation of content::NotificationObserver. |
| 186 virtual void Observe(int type, | 186 virtual void Observe(int type, |
| 187 const content::NotificationSource& source, | 187 const content::NotificationSource& source, |
| 188 const content::NotificationDetails& details) OVERRIDE; | 188 const content::NotificationDetails& details) override; |
| 189 | 189 |
| 190 void Wait(); | 190 void Wait(); |
| 191 | 191 |
| 192 private: | 192 private: |
| 193 std::vector<Profile*> profiles_; | 193 std::vector<Profile*> profiles_; |
| 194 bool observing_; | 194 bool observing_; |
| 195 | 195 |
| 196 content::NotificationRegistrar registrar_; | 196 content::NotificationRegistrar registrar_; |
| 197 | 197 |
| 198 // This installs apps, too. | 198 // This installs apps, too. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 for (int i = 0; i < test()->num_clients(); ++i) { | 341 for (int i = 0; i < test()->num_clients(); ++i) { |
| 342 profiles.push_back(test()->GetProfile(i)); | 342 profiles.push_back(test()->GetProfile(i)); |
| 343 } | 343 } |
| 344 | 344 |
| 345 AppsMatchChecker checker(profiles); | 345 AppsMatchChecker checker(profiles); |
| 346 checker.Wait(); | 346 checker.Wait(); |
| 347 return !checker.TimedOut(); | 347 return !checker.TimedOut(); |
| 348 } | 348 } |
| 349 | 349 |
| 350 } // namespace apps_helper | 350 } // namespace apps_helper |
| OLD | NEW |