| 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/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 login_db_.reset(new LoginDatabase()); | 117 login_db_.reset(new LoginDatabase()); |
| 118 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append( | 118 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append( |
| 119 FILE_PATH_LITERAL("login_test")))); | 119 FILE_PATH_LITERAL("login_test")))); |
| 120 | 120 |
| 121 wds_ = new WebDataService(); | 121 wds_ = new WebDataService(); |
| 122 ASSERT_TRUE(wds_->Init(temp_dir_.path())); | 122 ASSERT_TRUE(wds_->Init(temp_dir_.path())); |
| 123 } | 123 } |
| 124 | 124 |
| 125 virtual void TearDown() { | 125 virtual void TearDown() { |
| 126 wds_->Shutdown(); | 126 wds_->ShutdownOnUIThread(); |
| 127 wds_ = NULL; |
| 128 base::WaitableEvent done(false, false); |
| 129 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 130 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
| 131 done.Wait(); |
| 127 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 132 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 128 MessageLoop::current()->Run(); | 133 MessageLoop::current()->Run(); |
| 129 db_thread_.Stop(); | 134 db_thread_.Stop(); |
| 130 } | 135 } |
| 131 | 136 |
| 132 MessageLoopForUI message_loop_; | 137 MessageLoopForUI message_loop_; |
| 133 content::TestBrowserThread ui_thread_; | 138 content::TestBrowserThread ui_thread_; |
| 134 // PasswordStore, WDS schedule work on this thread. | 139 // PasswordStore, WDS schedule work on this thread. |
| 135 content::TestBrowserThread db_thread_; | 140 content::TestBrowserThread db_thread_; |
| 136 | 141 |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 // Deleting the login should trigger a notification. | 524 // Deleting the login should trigger a notification. |
| 520 store->RemoveLogin(*form); | 525 store->RemoveLogin(*form); |
| 521 | 526 |
| 522 // Wait for PasswordStore to send the notification. | 527 // Wait for PasswordStore to send the notification. |
| 523 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 528 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 524 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); | 529 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); |
| 525 done.Wait(); | 530 done.Wait(); |
| 526 | 531 |
| 527 store->ShutdownOnUIThread(); | 532 store->ShutdownOnUIThread(); |
| 528 } | 533 } |
| OLD | NEW |