| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/themes_helper.h" | 5 #include "chrome/browser/sync/test/integration/themes_helper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // The themes sync integration tests don't actually install any custom themes, | 83 // The themes sync integration tests don't actually install any custom themes, |
| 84 // but they do occasionally check that the ThemeService attempts to install | 84 // but they do occasionally check that the ThemeService attempts to install |
| 85 // synced themes. | 85 // synced themes. |
| 86 class ThemePendingInstallChecker : public StatusChangeChecker, | 86 class ThemePendingInstallChecker : public StatusChangeChecker, |
| 87 public content::NotificationObserver { | 87 public content::NotificationObserver { |
| 88 public: | 88 public: |
| 89 ThemePendingInstallChecker(Profile* profile, const std::string& theme); | 89 ThemePendingInstallChecker(Profile* profile, const std::string& theme); |
| 90 virtual ~ThemePendingInstallChecker(); | 90 virtual ~ThemePendingInstallChecker(); |
| 91 | 91 |
| 92 // Implementation of StatusChangeChecker. | 92 // Implementation of StatusChangeChecker. |
| 93 virtual std::string GetDebugMessage() const OVERRIDE; | 93 virtual std::string GetDebugMessage() const override; |
| 94 virtual bool IsExitConditionSatisfied() OVERRIDE; | 94 virtual bool IsExitConditionSatisfied() override; |
| 95 | 95 |
| 96 // Implementation of content::NotificationObserver. | 96 // Implementation of content::NotificationObserver. |
| 97 virtual void Observe(int type, | 97 virtual void Observe(int type, |
| 98 const content::NotificationSource& source, | 98 const content::NotificationSource& source, |
| 99 const content::NotificationDetails& details) OVERRIDE; | 99 const content::NotificationDetails& details) override; |
| 100 | 100 |
| 101 // Waits until the condition to be met or a timeout occurs. | 101 // Waits until the condition to be met or a timeout occurs. |
| 102 void Wait(); | 102 void Wait(); |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 Profile* profile_; | 105 Profile* profile_; |
| 106 const std::string& theme_; | 106 const std::string& theme_; |
| 107 | 107 |
| 108 content::NotificationRegistrar registrar_; | 108 content::NotificationRegistrar registrar_; |
| 109 }; | 109 }; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // The |exit_condition_| closure may be invoked zero or more times. | 163 // The |exit_condition_| closure may be invoked zero or more times. |
| 164 class ThemeConditionChecker : public StatusChangeChecker, | 164 class ThemeConditionChecker : public StatusChangeChecker, |
| 165 public content::NotificationObserver { | 165 public content::NotificationObserver { |
| 166 public: | 166 public: |
| 167 ThemeConditionChecker(Profile* profile, | 167 ThemeConditionChecker(Profile* profile, |
| 168 const std::string& debug_message_, | 168 const std::string& debug_message_, |
| 169 base::Callback<bool(ThemeService*)> exit_condition); | 169 base::Callback<bool(ThemeService*)> exit_condition); |
| 170 virtual ~ThemeConditionChecker(); | 170 virtual ~ThemeConditionChecker(); |
| 171 | 171 |
| 172 // Implementation of StatusChangeChecker. | 172 // Implementation of StatusChangeChecker. |
| 173 virtual std::string GetDebugMessage() const OVERRIDE; | 173 virtual std::string GetDebugMessage() const override; |
| 174 virtual bool IsExitConditionSatisfied() OVERRIDE; | 174 virtual bool IsExitConditionSatisfied() override; |
| 175 | 175 |
| 176 // Implementation of content::NotificationObserver. | 176 // Implementation of content::NotificationObserver. |
| 177 virtual void Observe(int type, | 177 virtual void Observe(int type, |
| 178 const content::NotificationSource& source, | 178 const content::NotificationSource& source, |
| 179 const content::NotificationDetails& details) OVERRIDE; | 179 const content::NotificationDetails& details) override; |
| 180 | 180 |
| 181 // Waits until the condition to be met or a timeout occurs. | 181 // Waits until the condition to be met or a timeout occurs. |
| 182 void Wait(); | 182 void Wait(); |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 Profile* profile_; | 185 Profile* profile_; |
| 186 const std::string debug_message_; | 186 const std::string debug_message_; |
| 187 base::Callback<bool(ThemeService*)> exit_condition_; | 187 base::Callback<bool(ThemeService*)> exit_condition_; |
| 188 | 188 |
| 189 content::NotificationRegistrar registrar_; | 189 content::NotificationRegistrar registrar_; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 bool AwaitUsingDefaultTheme(Profile* profile) { | 253 bool AwaitUsingDefaultTheme(Profile* profile) { |
| 254 ThemeConditionChecker checker( | 254 ThemeConditionChecker checker( |
| 255 profile, | 255 profile, |
| 256 std::string("Waiting until profile is using default theme"), | 256 std::string("Waiting until profile is using default theme"), |
| 257 base::Bind(&UsingDefaultThemeFunc)); | 257 base::Bind(&UsingDefaultThemeFunc)); |
| 258 checker.Wait(); | 258 checker.Wait(); |
| 259 return !checker.TimedOut(); | 259 return !checker.TimedOut(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace themes_helper | 262 } // namespace themes_helper |
| OLD | NEW |