| 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> |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void SetUp() override { | 126 void SetUp() override { |
| 127 ASSERT_TRUE(db_thread_.Start()); | 127 ASSERT_TRUE(db_thread_.Start()); |
| 128 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 128 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 129 | 129 |
| 130 profile_.reset(new TestingProfile()); | 130 profile_.reset(new TestingProfile()); |
| 131 | 131 |
| 132 base::FilePath path = temp_dir_.path().AppendASCII("web_data_test"); | 132 base::FilePath path = temp_dir_.GetPath().AppendASCII("web_data_test"); |
| 133 wdbs_ = new WebDatabaseService( | 133 wdbs_ = new WebDatabaseService( |
| 134 path, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | 134 path, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
| 135 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); | 135 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); |
| 136 // Need to add at least one table so the database gets created. | 136 // Need to add at least one table so the database gets created. |
| 137 wdbs_->AddTable(std::unique_ptr<WebDatabaseTable>(new LoginsTable())); | 137 wdbs_->AddTable(std::unique_ptr<WebDatabaseTable>(new LoginsTable())); |
| 138 wdbs_->LoadDatabase(); | 138 wdbs_->LoadDatabase(); |
| 139 wds_ = new PasswordWebDataService( | 139 wds_ = new PasswordWebDataService( |
| 140 wdbs_, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | 140 wdbs_, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
| 141 WebDataServiceBase::ProfileErrorCallback()); | 141 WebDataServiceBase::ProfileErrorCallback()); |
| 142 wds_->Init(); | 142 wds_->Init(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 159 BrowserThread::DB, FROM_HERE, | 159 BrowserThread::DB, FROM_HERE, |
| 160 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); | 160 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
| 161 done.Wait(); | 161 done.Wait(); |
| 162 base::ThreadTaskRunnerHandle::Get()->PostTask( | 162 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 163 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 163 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 164 base::RunLoop().Run(); | 164 base::RunLoop().Run(); |
| 165 db_thread_.Stop(); | 165 db_thread_.Stop(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 base::FilePath test_login_db_file_path() const { | 168 base::FilePath test_login_db_file_path() const { |
| 169 return temp_dir_.path().Append(FILE_PATH_LITERAL("login_test")); | 169 return temp_dir_.GetPath().Append(FILE_PATH_LITERAL("login_test")); |
| 170 } | 170 } |
| 171 | 171 |
| 172 PasswordStoreWin* CreatePasswordStore() { | 172 PasswordStoreWin* CreatePasswordStore() { |
| 173 return new PasswordStoreWin( | 173 return new PasswordStoreWin( |
| 174 base::ThreadTaskRunnerHandle::Get(), | 174 base::ThreadTaskRunnerHandle::Get(), |
| 175 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), | 175 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), |
| 176 base::MakeUnique<LoginDatabase>(test_login_db_file_path()), wds_.get()); | 176 base::MakeUnique<LoginDatabase>(test_login_db_file_path()), wds_.get()); |
| 177 } | 177 } |
| 178 | 178 |
| 179 base::MessageLoopForUI message_loop_; | 179 base::MessageLoopForUI message_loop_; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 446 |
| 447 // Make sure we quit the MessageLoop even if the test fails. | 447 // Make sure we quit the MessageLoop even if the test fails. |
| 448 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) | 448 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) |
| 449 .WillByDefault(QuitUIMessageLoop()); | 449 .WillByDefault(QuitUIMessageLoop()); |
| 450 | 450 |
| 451 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); | 451 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); |
| 452 | 452 |
| 453 store_->GetAutofillableLogins(&consumer); | 453 store_->GetAutofillableLogins(&consumer); |
| 454 base::RunLoop().Run(); | 454 base::RunLoop().Run(); |
| 455 } | 455 } |
| OLD | NEW |