| 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/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 18 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 20 #include "base/single_thread_task_runner.h" |
| 19 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
| 20 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
| 21 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 22 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 23 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
| 24 #include "components/os_crypt/ie7_password_win.h" | 26 #include "components/os_crypt/ie7_password_win.h" |
| 25 #include "components/password_manager/core/browser/password_manager_test_utils.h
" | 27 #include "components/password_manager/core/browser/password_manager_test_utils.h
" |
| 26 #include "components/password_manager/core/browser/password_store_consumer.h" | 28 #include "components/password_manager/core/browser/password_store_consumer.h" |
| 27 #include "components/password_manager/core/browser/webdata/logins_table.h" | 29 #include "components/password_manager/core/browser/webdata/logins_table.h" |
| 28 #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" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (store_.get()) | 144 if (store_.get()) |
| 143 store_->ShutdownOnUIThread(); | 145 store_->ShutdownOnUIThread(); |
| 144 wds_->ShutdownOnUIThread(); | 146 wds_->ShutdownOnUIThread(); |
| 145 wdbs_->ShutdownDatabase(); | 147 wdbs_->ShutdownDatabase(); |
| 146 wds_ = nullptr; | 148 wds_ = nullptr; |
| 147 wdbs_ = nullptr; | 149 wdbs_ = nullptr; |
| 148 base::WaitableEvent done(false, false); | 150 base::WaitableEvent done(false, false); |
| 149 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 151 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 150 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); | 152 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
| 151 done.Wait(); | 153 done.Wait(); |
| 152 base::MessageLoop::current()->PostTask( | 154 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 153 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 155 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 154 base::MessageLoop::current()->Run(); | 156 base::MessageLoop::current()->Run(); |
| 155 db_thread_.Stop(); | 157 db_thread_.Stop(); |
| 156 } | 158 } |
| 157 | 159 |
| 158 base::FilePath test_login_db_file_path() const { | 160 base::FilePath test_login_db_file_path() const { |
| 159 return temp_dir_.path().Append(FILE_PATH_LITERAL("login_test")); | 161 return temp_dir_.path().Append(FILE_PATH_LITERAL("login_test")); |
| 160 } | 162 } |
| 161 | 163 |
| 162 PasswordStoreWin* CreatePasswordStore() { | 164 PasswordStoreWin* CreatePasswordStore() { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 427 |
| 426 // Make sure we quit the MessageLoop even if the test fails. | 428 // Make sure we quit the MessageLoop even if the test fails. |
| 427 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) | 429 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) |
| 428 .WillByDefault(QuitUIMessageLoop()); | 430 .WillByDefault(QuitUIMessageLoop()); |
| 429 | 431 |
| 430 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); | 432 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); |
| 431 | 433 |
| 432 store_->GetAutofillableLogins(&consumer); | 434 store_->GetAutofillableLogins(&consumer); |
| 433 base::MessageLoop::current()->Run(); | 435 base::MessageLoop::current()->Run(); |
| 434 } | 436 } |
| OLD | NEW |