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/password_manager/password_store_win.h" | 5 #include "chrome/browser/password_manager/password_store_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
15 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
21 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
22 #include "base/stl_util.h" | |
23 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
24 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
25 #include "base/time/time.h" | 24 #include "base/time/time.h" |
26 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
27 #include "components/os_crypt/ie7_password_win.h" | 26 #include "components/os_crypt/ie7_password_win.h" |
28 #include "components/password_manager/core/browser/password_manager_test_utils.h
" | 27 #include "components/password_manager/core/browser/password_manager_test_utils.h
" |
29 #include "components/password_manager/core/browser/password_store_consumer.h" | 28 #include "components/password_manager/core/browser/password_store_consumer.h" |
30 #include "components/password_manager/core/browser/webdata/logins_table.h" | 29 #include "components/password_manager/core/browser/webdata/logins_table.h" |
31 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" | 30 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" |
32 #include "components/password_manager/core/common/password_manager_pref_names.h" | 31 #include "components/password_manager/core/common/password_manager_pref_names.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // PasswordStore, WDS schedule work on this thread. | 185 // PasswordStore, WDS schedule work on this thread. |
187 content::TestBrowserThread db_thread_; | 186 content::TestBrowserThread db_thread_; |
188 | 187 |
189 base::ScopedTempDir temp_dir_; | 188 base::ScopedTempDir temp_dir_; |
190 std::unique_ptr<TestingProfile> profile_; | 189 std::unique_ptr<TestingProfile> profile_; |
191 scoped_refptr<PasswordWebDataService> wds_; | 190 scoped_refptr<PasswordWebDataService> wds_; |
192 scoped_refptr<WebDatabaseService> wdbs_; | 191 scoped_refptr<WebDatabaseService> wdbs_; |
193 scoped_refptr<PasswordStore> store_; | 192 scoped_refptr<PasswordStore> store_; |
194 }; | 193 }; |
195 | 194 |
196 ACTION(STLDeleteElements0) { | |
197 base::STLDeleteContainerPointers(arg0.begin(), arg0.end()); | |
198 } | |
199 | |
200 ACTION(QuitUIMessageLoop) { | 195 ACTION(QuitUIMessageLoop) { |
201 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 196 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
202 base::MessageLoop::current()->QuitWhenIdle(); | 197 base::MessageLoop::current()->QuitWhenIdle(); |
203 } | 198 } |
204 | 199 |
205 MATCHER(EmptyWDResult, "") { | 200 MATCHER(EmptyWDResult, "") { |
206 return static_cast< | 201 return static_cast< |
207 const WDResult<std::vector<std::unique_ptr<PasswordForm>>>*>(arg) | 202 const WDResult<std::vector<std::unique_ptr<PasswordForm>>>*>(arg) |
208 ->GetValue() | 203 ->GetValue() |
209 .empty(); | 204 .empty(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 447 |
453 // Make sure we quit the MessageLoop even if the test fails. | 448 // Make sure we quit the MessageLoop even if the test fails. |
454 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) | 449 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) |
455 .WillByDefault(QuitUIMessageLoop()); | 450 .WillByDefault(QuitUIMessageLoop()); |
456 | 451 |
457 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); | 452 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); |
458 | 453 |
459 store_->GetAutofillableLogins(&consumer); | 454 store_->GetAutofillableLogins(&consumer); |
460 base::RunLoop().Run(); | 455 base::RunLoop().Run(); |
461 } | 456 } |
OLD | NEW |