| 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 <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 LocalFree(output.pbData); | 108 LocalFree(output.pbData); |
| 109 | 109 |
| 110 info->url_hash = ie7_password::GetUrlHash(url); | 110 info->url_hash = ie7_password::GetUrlHash(url); |
| 111 info->encrypted_data = encrypted_data; | 111 info->encrypted_data = encrypted_data; |
| 112 info->date_created = created; | 112 info->date_created = created; |
| 113 | 113 |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 virtual void SetUp() { | 117 void SetUp() override { |
| 118 ASSERT_TRUE(db_thread_.Start()); | 118 ASSERT_TRUE(db_thread_.Start()); |
| 119 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 119 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 120 | 120 |
| 121 profile_.reset(new TestingProfile()); | 121 profile_.reset(new TestingProfile()); |
| 122 | 122 |
| 123 base::FilePath path = temp_dir_.path().AppendASCII("web_data_test"); | 123 base::FilePath path = temp_dir_.path().AppendASCII("web_data_test"); |
| 124 wdbs_ = new WebDatabaseService(path, | 124 wdbs_ = new WebDatabaseService(path, |
| 125 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 125 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 126 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); | 126 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); |
| 127 // Need to add at least one table so the database gets created. | 127 // Need to add at least one table so the database gets created. |
| 128 wdbs_->AddTable(scoped_ptr<WebDatabaseTable>(new LoginsTable())); | 128 wdbs_->AddTable(scoped_ptr<WebDatabaseTable>(new LoginsTable())); |
| 129 wdbs_->LoadDatabase(); | 129 wdbs_->LoadDatabase(); |
| 130 wds_ = new PasswordWebDataService( | 130 wds_ = new PasswordWebDataService( |
| 131 wdbs_, | 131 wdbs_, |
| 132 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 132 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 133 WebDataServiceBase::ProfileErrorCallback()); | 133 WebDataServiceBase::ProfileErrorCallback()); |
| 134 wds_->Init(); | 134 wds_->Init(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 virtual void TearDown() { | 137 void TearDown() override { |
| 138 if (store_.get()) | 138 if (store_.get()) |
| 139 store_->Shutdown(); | 139 store_->Shutdown(); |
| 140 wds_->ShutdownOnUIThread(); | 140 wds_->ShutdownOnUIThread(); |
| 141 wdbs_->ShutdownDatabase(); | 141 wdbs_->ShutdownDatabase(); |
| 142 wds_ = nullptr; | 142 wds_ = nullptr; |
| 143 wdbs_ = nullptr; | 143 wdbs_ = nullptr; |
| 144 base::WaitableEvent done(false, false); | 144 base::WaitableEvent done(false, false); |
| 145 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 145 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 146 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); | 146 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
| 147 done.Wait(); | 147 done.Wait(); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 421 |
| 422 // Make sure we quit the MessageLoop even if the test fails. | 422 // Make sure we quit the MessageLoop even if the test fails. |
| 423 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) | 423 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) |
| 424 .WillByDefault(QuitUIMessageLoop()); | 424 .WillByDefault(QuitUIMessageLoop()); |
| 425 | 425 |
| 426 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); | 426 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); |
| 427 | 427 |
| 428 store_->GetAutofillableLogins(&consumer); | 428 store_->GetAutofillableLogins(&consumer); |
| 429 base::MessageLoop::current()->Run(); | 429 base::MessageLoop::current()->Run(); |
| 430 } | 430 } |
| OLD | NEW |