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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 profile_.reset(new TestingProfile()); | 277 profile_.reset(new TestingProfile()); |
278 | 278 |
279 login_db_.reset(new LoginDatabase()); | 279 login_db_.reset(new LoginDatabase()); |
280 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append("login_test"))); | 280 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append("login_test"))); |
281 | 281 |
282 wds_ = new WebDataService(); | 282 wds_ = new WebDataService(); |
283 ASSERT_TRUE(wds_->Init(temp_dir_.path())); | 283 ASSERT_TRUE(wds_->Init(temp_dir_.path())); |
284 } | 284 } |
285 | 285 |
286 virtual void TearDown() { | 286 virtual void TearDown() { |
287 wds_->Shutdown(); | 287 wds_->ShutdownOnUIThread(); |
| 288 wds_ = NULL; |
| 289 base::WaitableEvent done(false, false); |
| 290 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 291 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
| 292 done.Wait(); |
288 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 293 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
289 MessageLoop::current()->Run(); | 294 MessageLoop::current()->Run(); |
290 db_thread_.Stop(); | 295 db_thread_.Stop(); |
291 } | 296 } |
292 | 297 |
293 PasswordStoreX::NativeBackend* GetBackend() { | 298 PasswordStoreX::NativeBackend* GetBackend() { |
294 switch (GetParam()) { | 299 switch (GetParam()) { |
295 case FAILING_BACKEND: | 300 case FAILING_BACKEND: |
296 return new FailingBackend(); | 301 return new FailingBackend(); |
297 case WORKING_BACKEND: | 302 case WORKING_BACKEND: |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 | 750 |
746 INSTANTIATE_TEST_CASE_P(NoBackend, | 751 INSTANTIATE_TEST_CASE_P(NoBackend, |
747 PasswordStoreXTest, | 752 PasswordStoreXTest, |
748 testing::Values(NO_BACKEND)); | 753 testing::Values(NO_BACKEND)); |
749 INSTANTIATE_TEST_CASE_P(FailingBackend, | 754 INSTANTIATE_TEST_CASE_P(FailingBackend, |
750 PasswordStoreXTest, | 755 PasswordStoreXTest, |
751 testing::Values(FAILING_BACKEND)); | 756 testing::Values(FAILING_BACKEND)); |
752 INSTANTIATE_TEST_CASE_P(WorkingBackend, | 757 INSTANTIATE_TEST_CASE_P(WorkingBackend, |
753 PasswordStoreXTest, | 758 PasswordStoreXTest, |
754 testing::Values(WORKING_BACKEND)); | 759 testing::Values(WORKING_BACKEND)); |
OLD | NEW |