OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_RENDERER_AUTOFILL_FAKE_PASSWORD_MANAGER_CLIENT_H_ |
| 6 #define CHROME_RENDERER_AUTOFILL_FAKE_PASSWORD_MANAGER_CLIENT_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/optional.h" |
| 12 #include "base/strings/string16.h" |
| 13 #include "components/autofill/content/public/interfaces/autofill_driver.mojom.h" |
| 14 #include "components/autofill/core/common/password_form.h" |
| 15 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 16 |
| 17 class FakePasswordManagerClient |
| 18 : public autofill::mojom::PasswordManagerClient { |
| 19 public: |
| 20 FakePasswordManagerClient(); |
| 21 |
| 22 ~FakePasswordManagerClient() override; |
| 23 |
| 24 void BindRequest( |
| 25 autofill::mojom::PasswordManagerClientAssociatedRequest request); |
| 26 |
| 27 void Flush(); |
| 28 |
| 29 bool called_show_pw_generation_popup() const { |
| 30 return called_show_pw_generation_popup_; |
| 31 } |
| 32 |
| 33 bool called_generation_available_for_form() const { |
| 34 return called_generation_available_for_form_; |
| 35 } |
| 36 |
| 37 bool called_hide_pw_generation_popup() const { |
| 38 return called_hide_pw_generation_popup_; |
| 39 } |
| 40 |
| 41 void reset_called_show_pw_generation_popup() { |
| 42 called_show_pw_generation_popup_ = false; |
| 43 } |
| 44 |
| 45 void reset_called_generation_available_for_form() { |
| 46 called_generation_available_for_form_ = false; |
| 47 } |
| 48 |
| 49 void reset_called_hide_pw_generation_popup() { |
| 50 called_hide_pw_generation_popup_ = false; |
| 51 } |
| 52 |
| 53 private: |
| 54 // autofill::mojom::PasswordManagerClient: |
| 55 void ShowPasswordGenerationPopup(const gfx::RectF& bounds, |
| 56 int max_length, |
| 57 const base::string16& generation_element, |
| 58 bool is_manually_triggered, |
| 59 const autofill::PasswordForm& form) override; |
| 60 |
| 61 void ShowPasswordEditingPopup(const gfx::RectF& bounds, |
| 62 const autofill::PasswordForm& form) override; |
| 63 |
| 64 void GenerationAvailableForForm(const autofill::PasswordForm& form) override; |
| 65 |
| 66 void HidePasswordGenerationPopup() override; |
| 67 |
| 68 // Records whether ShowPasswordGenerationPopup() gets called. |
| 69 bool called_show_pw_generation_popup_ = false; |
| 70 |
| 71 // Records whether GenerationAvailableForForm() gets called. |
| 72 bool called_generation_available_for_form_ = false; |
| 73 |
| 74 // Records whether HidePasswordGenerationPopup() gets called. |
| 75 bool called_hide_pw_generation_popup_ = false; |
| 76 |
| 77 mojo::AssociatedBinding<autofill::mojom::PasswordManagerClient> binding_; |
| 78 }; |
| 79 |
| 80 #endif // CHROME_RENDERER_AUTOFILL_FAKE_PASSWORD_MANAGER_CLIENT_H_ |
OLD | NEW |