OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_TEST_PASSWORD_AUTOFILL_AGENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_TEST_PASSWORD_AUTOFILL_AGENT_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_TEST_PASSWORD_AUTOFILL_AGENT_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_TEST_PASSWORD_AUTOFILL_AGENT_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/scoped_vector.h" |
8 #include "components/autofill/content/renderer/password_autofill_agent.h" | 11 #include "components/autofill/content/renderer/password_autofill_agent.h" |
| 12 #include "ipc/ipc_message.h" |
9 | 13 |
10 namespace autofill { | 14 namespace autofill { |
11 | 15 |
12 class TestPasswordAutofillAgent : public PasswordAutofillAgent { | 16 class TestPasswordAutofillAgent : public PasswordAutofillAgent { |
13 public: | 17 public: |
14 explicit TestPasswordAutofillAgent(content::RenderView* render_view); | 18 explicit TestPasswordAutofillAgent(content::RenderView* render_view); |
15 virtual ~TestPasswordAutofillAgent(); | 19 virtual ~TestPasswordAutofillAgent(); |
16 | 20 |
| 21 // content::RenderViewObserver implementation: |
| 22 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 23 |
| 24 // Access messages that would have been sent to the browser. |
| 25 const std::vector<IPC::Message*>& messages() const { return messages_.get(); } |
| 26 |
| 27 // Enqueue messages and do not forward them. |
| 28 void pause_messages() { pause_messages_ = true; } |
| 29 |
| 30 // Stop enqueuing messages and forward on all received messages. |
| 31 void resume_messages(); |
| 32 |
| 33 void clear_messages() { messages_.clear(); } |
| 34 |
17 private: | 35 private: |
18 // Always returns true. This allows browser tests with "data: " URL scheme to | 36 // Always returns true. This allows browser tests with "data: " URL scheme to |
19 // work with the password manager. | 37 // work with the password manager. |
20 // PasswordAutofillAgent: | 38 // PasswordAutofillAgent: |
21 virtual bool OriginCanAccessPasswordManager( | 39 virtual bool OriginCanAccessPasswordManager( |
22 const blink::WebSecurityOrigin& origin) OVERRIDE; | 40 const blink::WebSecurityOrigin& origin) OVERRIDE; |
| 41 |
| 42 ScopedVector<IPC::Message> messages_; |
| 43 |
| 44 bool pause_messages_; |
23 }; | 45 }; |
24 | 46 |
25 } // namespace autofill | 47 } // namespace autofill |
26 | 48 |
27 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_TEST_PASSWORD_AUTOFILL_AGENT_H_ | 49 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_TEST_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |