| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 virtual void OnExtensionUnloaded( | 154 virtual void OnExtensionUnloaded( |
| 155 content::BrowserContext* context, | 155 content::BrowserContext* context, |
| 156 const extensions::Extension* extenion, | 156 const extensions::Extension* extenion, |
| 157 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; | 157 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| 158 virtual void OnExtensionInstalled( | 158 virtual void OnExtensionInstalled( |
| 159 content::BrowserContext* browser_context, | 159 content::BrowserContext* browser_context, |
| 160 const extensions::Extension* extension, | 160 const extensions::Extension* extension, |
| 161 bool is_update) OVERRIDE; | 161 bool is_update) OVERRIDE; |
| 162 virtual void OnExtensionUninstalled( | 162 virtual void OnExtensionUninstalled( |
| 163 content::BrowserContext* browser_context, | 163 content::BrowserContext* browser_context, |
| 164 const extensions::Extension* extension) OVERRIDE; | 164 const extensions::Extension* extension, |
| 165 extensions::UninstallReason reason) OVERRIDE; |
| 165 | 166 |
| 166 void Wait(); | 167 void Wait(); |
| 167 | 168 |
| 168 private: | 169 private: |
| 169 std::vector<Profile*> profiles_; | 170 std::vector<Profile*> profiles_; |
| 170 ScopedVector<SyncedExtensionInstaller> synced_extension_installers_; | 171 ScopedVector<SyncedExtensionInstaller> synced_extension_installers_; |
| 171 bool observing_; | 172 bool observing_; |
| 172 | 173 |
| 173 DISALLOW_COPY_AND_ASSIGN(ExtensionsMatchChecker); | 174 DISALLOW_COPY_AND_ASSIGN(ExtensionsMatchChecker); |
| 174 }; | 175 }; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 224 |
| 224 void ExtensionsMatchChecker::OnExtensionInstalled( | 225 void ExtensionsMatchChecker::OnExtensionInstalled( |
| 225 content::BrowserContext* browser_context, | 226 content::BrowserContext* browser_context, |
| 226 const extensions::Extension* extension, | 227 const extensions::Extension* extension, |
| 227 bool is_update) { | 228 bool is_update) { |
| 228 CheckExitCondition(); | 229 CheckExitCondition(); |
| 229 } | 230 } |
| 230 | 231 |
| 231 void ExtensionsMatchChecker::OnExtensionUninstalled( | 232 void ExtensionsMatchChecker::OnExtensionUninstalled( |
| 232 content::BrowserContext* browser_context, | 233 content::BrowserContext* browser_context, |
| 233 const extensions::Extension* extension) { | 234 const extensions::Extension* extension, |
| 235 extensions::UninstallReason reason) { |
| 234 CheckExitCondition(); | 236 CheckExitCondition(); |
| 235 } | 237 } |
| 236 | 238 |
| 237 void ExtensionsMatchChecker::Wait() { | 239 void ExtensionsMatchChecker::Wait() { |
| 238 for (std::vector<Profile*>::iterator it = profiles_.begin(); | 240 for (std::vector<Profile*>::iterator it = profiles_.begin(); |
| 239 it != profiles_.end(); | 241 it != profiles_.end(); |
| 240 ++it) { | 242 ++it) { |
| 241 // Begin mocking the installation of synced extensions from the web store. | 243 // Begin mocking the installation of synced extensions from the web store. |
| 242 synced_extension_installers_.push_back(new SyncedExtensionInstaller(*it)); | 244 synced_extension_installers_.push_back(new SyncedExtensionInstaller(*it)); |
| 243 | 245 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 265 for (int i = 0; i < test()->num_clients(); ++i) { | 267 for (int i = 0; i < test()->num_clients(); ++i) { |
| 266 profiles.push_back(test()->GetProfile(i)); | 268 profiles.push_back(test()->GetProfile(i)); |
| 267 } | 269 } |
| 268 | 270 |
| 269 ExtensionsMatchChecker checker(profiles); | 271 ExtensionsMatchChecker checker(profiles); |
| 270 checker.Wait(); | 272 checker.Wait(); |
| 271 return !checker.TimedOut(); | 273 return !checker.TimedOut(); |
| 272 } | 274 } |
| 273 | 275 |
| 274 } // namespace extensions_helper | 276 } // namespace extensions_helper |
| OLD | NEW |