| 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/extensions_helper.h" | 5 #include "chrome/browser/sync/test/integration/extensions_helper.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 namespace { | 136 namespace { |
| 137 | 137 |
| 138 // A helper class to implement waiting for a set of profiles to have matching | 138 // A helper class to implement waiting for a set of profiles to have matching |
| 139 // extensions lists. | 139 // extensions lists. |
| 140 class ExtensionsMatchChecker : public StatusChangeChecker, | 140 class ExtensionsMatchChecker : public StatusChangeChecker, |
| 141 public extensions::ExtensionRegistryObserver { | 141 public extensions::ExtensionRegistryObserver { |
| 142 public: | 142 public: |
| 143 explicit ExtensionsMatchChecker(const std::vector<Profile*>& profiles); | 143 explicit ExtensionsMatchChecker(const std::vector<Profile*>& profiles); |
| 144 virtual ~ExtensionsMatchChecker(); | 144 ~ExtensionsMatchChecker() override; |
| 145 | 145 |
| 146 // StatusChangeChecker implementation. | 146 // StatusChangeChecker implementation. |
| 147 virtual std::string GetDebugMessage() const override; | 147 std::string GetDebugMessage() const override; |
| 148 virtual bool IsExitConditionSatisfied() override; | 148 bool IsExitConditionSatisfied() override; |
| 149 | 149 |
| 150 // extensions::ExtensionRegistryObserver implementation. | 150 // extensions::ExtensionRegistryObserver implementation. |
| 151 virtual void OnExtensionLoaded( | 151 void OnExtensionLoaded(content::BrowserContext* context, |
| 152 content::BrowserContext* context, | 152 const extensions::Extension* extension) override; |
| 153 const extensions::Extension* extension) override; | 153 void OnExtensionUnloaded( |
| 154 virtual void OnExtensionUnloaded( | |
| 155 content::BrowserContext* context, | 154 content::BrowserContext* context, |
| 156 const extensions::Extension* extenion, | 155 const extensions::Extension* extenion, |
| 157 extensions::UnloadedExtensionInfo::Reason reason) override; | 156 extensions::UnloadedExtensionInfo::Reason reason) override; |
| 158 virtual void OnExtensionInstalled( | 157 void OnExtensionInstalled(content::BrowserContext* browser_context, |
| 159 content::BrowserContext* browser_context, | 158 const extensions::Extension* extension, |
| 160 const extensions::Extension* extension, | 159 bool is_update) override; |
| 161 bool is_update) override; | 160 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
| 162 virtual void OnExtensionUninstalled( | 161 const extensions::Extension* extension, |
| 163 content::BrowserContext* browser_context, | 162 extensions::UninstallReason reason) override; |
| 164 const extensions::Extension* extension, | |
| 165 extensions::UninstallReason reason) override; | |
| 166 | 163 |
| 167 void Wait(); | 164 void Wait(); |
| 168 | 165 |
| 169 private: | 166 private: |
| 170 std::vector<Profile*> profiles_; | 167 std::vector<Profile*> profiles_; |
| 171 ScopedVector<SyncedExtensionInstaller> synced_extension_installers_; | 168 ScopedVector<SyncedExtensionInstaller> synced_extension_installers_; |
| 172 bool observing_; | 169 bool observing_; |
| 173 | 170 |
| 174 DISALLOW_COPY_AND_ASSIGN(ExtensionsMatchChecker); | 171 DISALLOW_COPY_AND_ASSIGN(ExtensionsMatchChecker); |
| 175 }; | 172 }; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 for (int i = 0; i < test()->num_clients(); ++i) { | 264 for (int i = 0; i < test()->num_clients(); ++i) { |
| 268 profiles.push_back(test()->GetProfile(i)); | 265 profiles.push_back(test()->GetProfile(i)); |
| 269 } | 266 } |
| 270 | 267 |
| 271 ExtensionsMatchChecker checker(profiles); | 268 ExtensionsMatchChecker checker(profiles); |
| 272 checker.Wait(); | 269 checker.Wait(); |
| 273 return !checker.TimedOut(); | 270 return !checker.TimedOut(); |
| 274 } | 271 } |
| 275 | 272 |
| 276 } // namespace extensions_helper | 273 } // namespace extensions_helper |
| OLD | NEW |