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 CHROME_BROWSER_PASSWORD_MANAGER_TEST_PASSWORD_STORE_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_TEST_PASSWORD_STORE_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_TEST_PASSWORD_STORE_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_TEST_PASSWORD_STORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "chrome/browser/password_manager/password_store.h" | 13 #include "chrome/browser/password_manager/password_store.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class BrowserContext; | 16 class BrowserContext; |
17 } | 17 } |
18 | 18 |
19 scoped_refptr<RefcountedProfileKeyedService> CreateTestPasswordStore( | 19 scoped_refptr<RefcountedBrowserContextKeyedService> CreateTestPasswordStore( |
20 content::BrowserContext* profile); | 20 content::BrowserContext* profile); |
21 | 21 |
22 // A very simple PasswordStore implementation that keeps all of the passwords | 22 // A very simple PasswordStore implementation that keeps all of the passwords |
23 // in memory and does all it's manipulations on the main thread. Since this | 23 // in memory and does all it's manipulations on the main thread. Since this |
24 // is only used for testing, only the parts of the interface that are needed | 24 // is only used for testing, only the parts of the interface that are needed |
25 // for testing have been implemented. | 25 // for testing have been implemented. |
26 class TestPasswordStore : public PasswordStore { | 26 class TestPasswordStore : public PasswordStore { |
27 public: | 27 public: |
28 TestPasswordStore(); | 28 TestPasswordStore(); |
29 | 29 |
30 // Helper function for registration with | 30 // Helper function for registration with |
31 // RefcountedProfileKeyedService::SetTestingFactory | 31 // RefcountedBrowserContextKeyedService::SetTestingFactory |
32 static scoped_refptr<RefcountedProfileKeyedService> Create( | 32 static scoped_refptr<RefcountedBrowserContextKeyedService> Create( |
33 content::BrowserContext* profile); | 33 content::BrowserContext* profile); |
34 | 34 |
35 typedef std::map<std::string /* signon_realm */, | 35 typedef std::map<std::string /* signon_realm */, |
36 std::vector<content::PasswordForm> > PasswordMap; | 36 std::vector<content::PasswordForm> > PasswordMap; |
37 | 37 |
38 PasswordMap stored_passwords(); | 38 PasswordMap stored_passwords(); |
39 void Clear(); | 39 void Clear(); |
40 | 40 |
41 protected: | 41 protected: |
42 virtual ~TestPasswordStore(); | 42 virtual ~TestPasswordStore(); |
(...skipping 25 matching lines...) Expand all Loading... |
68 std::vector<content::PasswordForm*>* forms) OVERRIDE; | 68 std::vector<content::PasswordForm*>* forms) OVERRIDE; |
69 virtual void ShutdownOnUIThread() OVERRIDE {} | 69 virtual void ShutdownOnUIThread() OVERRIDE {} |
70 | 70 |
71 private: | 71 private: |
72 PasswordMap stored_passwords_; | 72 PasswordMap stored_passwords_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(TestPasswordStore); | 74 DISALLOW_COPY_AND_ASSIGN(TestPasswordStore); |
75 }; | 75 }; |
76 | 76 |
77 #endif // CHROME_BROWSER_PASSWORD_MANAGER_TEST_PASSWORD_STORE_H_ | 77 #endif // CHROME_BROWSER_PASSWORD_MANAGER_TEST_PASSWORD_STORE_H_ |
OLD | NEW |