| 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/passwords_helper.h" | 5 #include "chrome/browser/sync/test/integration/passwords_helper.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 wait_event->Signal(); | 38 wait_event->Signal(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 class PasswordStoreConsumerHelper | 41 class PasswordStoreConsumerHelper |
| 42 : public password_manager::PasswordStoreConsumer { | 42 : public password_manager::PasswordStoreConsumer { |
| 43 public: | 43 public: |
| 44 explicit PasswordStoreConsumerHelper(std::vector<PasswordForm>* result) | 44 explicit PasswordStoreConsumerHelper(std::vector<PasswordForm>* result) |
| 45 : password_manager::PasswordStoreConsumer(), result_(result) {} | 45 : password_manager::PasswordStoreConsumer(), result_(result) {} |
| 46 | 46 |
| 47 virtual void OnGetPasswordStoreResults( | 47 virtual void OnGetPasswordStoreResults( |
| 48 const std::vector<PasswordForm*>& result) OVERRIDE { | 48 const std::vector<PasswordForm*>& result) override { |
| 49 result_->clear(); | 49 result_->clear(); |
| 50 for (std::vector<PasswordForm*>::const_iterator it = result.begin(); | 50 for (std::vector<PasswordForm*>::const_iterator it = result.begin(); |
| 51 it != result.end(); | 51 it != result.end(); |
| 52 ++it) { | 52 ++it) { |
| 53 result_->push_back(**it); | 53 result_->push_back(**it); |
| 54 delete *it; | 54 delete *it; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Quit the message loop to wake up passwords_helper::GetLogins. | 57 // Quit the message loop to wake up passwords_helper::GetLogins. |
| 58 base::MessageLoopForUI::current()->Quit(); | 58 base::MessageLoopForUI::current()->Quit(); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 namespace { | 213 namespace { |
| 214 | 214 |
| 215 // Helper class used in the implementation of | 215 // Helper class used in the implementation of |
| 216 // AwaitAllProfilesContainSamePasswordForms. | 216 // AwaitAllProfilesContainSamePasswordForms. |
| 217 class SamePasswordFormsChecker : public MultiClientStatusChangeChecker { | 217 class SamePasswordFormsChecker : public MultiClientStatusChangeChecker { |
| 218 public: | 218 public: |
| 219 SamePasswordFormsChecker(); | 219 SamePasswordFormsChecker(); |
| 220 virtual ~SamePasswordFormsChecker(); | 220 virtual ~SamePasswordFormsChecker(); |
| 221 | 221 |
| 222 virtual bool IsExitConditionSatisfied() OVERRIDE; | 222 virtual bool IsExitConditionSatisfied() override; |
| 223 virtual std::string GetDebugMessage() const OVERRIDE; | 223 virtual std::string GetDebugMessage() const override; |
| 224 | 224 |
| 225 private: | 225 private: |
| 226 bool in_progress_; | 226 bool in_progress_; |
| 227 bool needs_recheck_; | 227 bool needs_recheck_; |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 SamePasswordFormsChecker::SamePasswordFormsChecker() | 230 SamePasswordFormsChecker::SamePasswordFormsChecker() |
| 231 : MultiClientStatusChangeChecker( | 231 : MultiClientStatusChangeChecker( |
| 232 sync_datatype_helper::test()->GetSyncServices()), | 232 sync_datatype_helper::test()->GetSyncServices()), |
| 233 in_progress_(false), | 233 in_progress_(false), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 namespace { | 282 namespace { |
| 283 | 283 |
| 284 // Helper class used in the implementation of | 284 // Helper class used in the implementation of |
| 285 // AwaitProfileContainSamePasswordFormsAsVerifier. | 285 // AwaitProfileContainSamePasswordFormsAsVerifier. |
| 286 class SamePasswordFormsAsVerifierChecker | 286 class SamePasswordFormsAsVerifierChecker |
| 287 : public SingleClientStatusChangeChecker { | 287 : public SingleClientStatusChangeChecker { |
| 288 public: | 288 public: |
| 289 explicit SamePasswordFormsAsVerifierChecker(int index); | 289 explicit SamePasswordFormsAsVerifierChecker(int index); |
| 290 virtual ~SamePasswordFormsAsVerifierChecker(); | 290 virtual ~SamePasswordFormsAsVerifierChecker(); |
| 291 | 291 |
| 292 virtual bool IsExitConditionSatisfied() OVERRIDE; | 292 virtual bool IsExitConditionSatisfied() override; |
| 293 virtual std::string GetDebugMessage() const OVERRIDE; | 293 virtual std::string GetDebugMessage() const override; |
| 294 | 294 |
| 295 private: | 295 private: |
| 296 int index_; | 296 int index_; |
| 297 | 297 |
| 298 bool in_progress_; | 298 bool in_progress_; |
| 299 bool needs_recheck_; | 299 bool needs_recheck_; |
| 300 }; | 300 }; |
| 301 | 301 |
| 302 SamePasswordFormsAsVerifierChecker::SamePasswordFormsAsVerifierChecker(int i) | 302 SamePasswordFormsAsVerifierChecker::SamePasswordFormsAsVerifierChecker(int i) |
| 303 : SingleClientStatusChangeChecker( | 303 : SingleClientStatusChangeChecker( |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); | 360 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); |
| 361 form.username_value = | 361 form.username_value = |
| 362 base::ASCIIToUTF16(base::StringPrintf("username%d", index)); | 362 base::ASCIIToUTF16(base::StringPrintf("username%d", index)); |
| 363 form.password_value = | 363 form.password_value = |
| 364 base::ASCIIToUTF16(base::StringPrintf("password%d", index)); | 364 base::ASCIIToUTF16(base::StringPrintf("password%d", index)); |
| 365 form.date_created = base::Time::Now(); | 365 form.date_created = base::Time::Now(); |
| 366 return form; | 366 return form; |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace passwords_helper | 369 } // namespace passwords_helper |
| OLD | NEW |