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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 : ui_thread_(BrowserThread::UI, &message_loop_), | 65 : ui_thread_(BrowserThread::UI, &message_loop_), |
66 db_thread_(BrowserThread::DB) {} | 66 db_thread_(BrowserThread::DB) {} |
67 | 67 |
68 protected: | 68 protected: |
69 virtual void SetUp() { | 69 virtual void SetUp() { |
70 db_thread_.Start(); | 70 db_thread_.Start(); |
71 | 71 |
72 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 72 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
73 base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB"); | 73 base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB"); |
74 | 74 |
75 wdbs_ = new WebDatabaseService(path); | 75 wdbs_ = new WebDatabaseService(path, |
| 76 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)); |
76 wdbs_->AddTable(scoped_ptr<WebDatabaseTable>(new AutofillTable("en-US"))); | 77 wdbs_->AddTable(scoped_ptr<WebDatabaseTable>(new AutofillTable("en-US"))); |
77 wdbs_->LoadDatabase(); | 78 wdbs_->LoadDatabase(); |
78 | 79 |
79 wds_ = new AutofillWebDataService( | 80 wds_ = new AutofillWebDataService( |
80 wdbs_, WebDataServiceBase::ProfileErrorCallback()); | 81 wdbs_, WebDataServiceBase::ProfileErrorCallback()); |
81 wds_->Init(); | 82 wds_->Init(); |
82 } | 83 } |
83 | 84 |
84 virtual void TearDown() { | 85 virtual void TearDown() { |
85 wds_->ShutdownOnUIThread(); | 86 wds_->ShutdownOnUIThread(); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 529 |
529 // Check that the credit card was removed. | 530 // Check that the credit card was removed. |
530 AutofillWebDataServiceConsumer<std::vector<CreditCard*> > card_consumer2; | 531 AutofillWebDataServiceConsumer<std::vector<CreditCard*> > card_consumer2; |
531 handle2 = wds_->GetCreditCards(&card_consumer2); | 532 handle2 = wds_->GetCreditCards(&card_consumer2); |
532 base::MessageLoop::current()->Run(); | 533 base::MessageLoop::current()->Run(); |
533 EXPECT_EQ(handle2, card_consumer2.handle()); | 534 EXPECT_EQ(handle2, card_consumer2.handle()); |
534 ASSERT_EQ(0U, card_consumer2.result().size()); | 535 ASSERT_EQ(0U, card_consumer2.result().size()); |
535 } | 536 } |
536 | 537 |
537 } // namespace autofill | 538 } // namespace autofill |
OLD | NEW |