| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/string16.h" | 16 #include "base/string16.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 19 #include "base/time.h" | 19 #include "base/time.h" |
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 21 #include "chrome/browser/autofill/autofill_profile.h" | 21 #include "chrome/browser/autofill/autofill_profile.h" |
| 22 #include "chrome/browser/autofill/credit_card.h" | 22 #include "chrome/browser/autofill/credit_card.h" |
| 23 #include "chrome/browser/webdata/autofill_change.h" | 23 #include "chrome/browser/webdata/autofill_change.h" |
| 24 #include "chrome/browser/webdata/autofill_entry.h" | 24 #include "chrome/browser/webdata/autofill_entry.h" |
| 25 #include "chrome/browser/webdata/web_data_service.h" | 25 #include "chrome/browser/webdata/web_data_service.h" |
| 26 #include "chrome/browser/webdata/web_data_service_test_util.h" | 26 #include "chrome/browser/webdata/web_data_service_test_util.h" |
| 27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
| 28 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
| 29 #include "chrome/common/guid.h" | 29 #include "chrome/common/guid.h" |
| 30 #include "chrome/test/testing_browser_process_test.h" |
| 30 #include "chrome/test/thread_observer_helper.h" | 31 #include "chrome/test/thread_observer_helper.h" |
| 31 #include "content/browser/browser_thread.h" | 32 #include "content/browser/browser_thread.h" |
| 32 #include "content/common/notification_details.h" | 33 #include "content/common/notification_details.h" |
| 33 #include "content/common/notification_service.h" | 34 #include "content/common/notification_service.h" |
| 34 #include "testing/gmock/include/gmock/gmock.h" | 35 #include "testing/gmock/include/gmock/gmock.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "webkit/glue/form_field.h" | 37 #include "webkit/glue/form_field.h" |
| 37 | 38 |
| 38 using base::Time; | 39 using base::Time; |
| 39 using base::TimeDelta; | 40 using base::TimeDelta; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 60 NotificationService::AllSources()); | 61 NotificationService::AllSources()); |
| 61 registrar_.Add(&observer_, | 62 registrar_.Add(&observer_, |
| 62 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, | 63 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, |
| 63 NotificationService::AllSources()); | 64 NotificationService::AllSources()); |
| 64 registrar_.Add(&observer_, | 65 registrar_.Add(&observer_, |
| 65 chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, | 66 chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, |
| 66 NotificationService::AllSources()); | 67 NotificationService::AllSources()); |
| 67 } | 68 } |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 class WebDataServiceTest : public testing::Test { | 71 class WebDataServiceTest : public TestingBrowserProcessTest { |
| 71 public: | 72 public: |
| 72 WebDataServiceTest() | 73 WebDataServiceTest() |
| 73 : ui_thread_(BrowserThread::UI, &message_loop_), | 74 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 74 db_thread_(BrowserThread::DB) {} | 75 db_thread_(BrowserThread::DB) {} |
| 75 | 76 |
| 76 protected: | 77 protected: |
| 77 virtual void SetUp() { | 78 virtual void SetUp() { |
| 78 db_thread_.Start(); | 79 db_thread_.Start(); |
| 79 | 80 |
| 80 PathService::Get(chrome::DIR_TEST_DATA, &profile_dir_); | 81 PathService::Get(chrome::DIR_TEST_DATA, &profile_dir_); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 ASSERT_EQ(0U, profile_consumer2.result().size()); | 567 ASSERT_EQ(0U, profile_consumer2.result().size()); |
| 567 | 568 |
| 568 // Check that the credit card was removed. | 569 // Check that the credit card was removed. |
| 569 AutofillWebDataServiceConsumer<std::vector<CreditCard*> > | 570 AutofillWebDataServiceConsumer<std::vector<CreditCard*> > |
| 570 card_consumer2; | 571 card_consumer2; |
| 571 handle2 = wds_->GetCreditCards(&card_consumer2); | 572 handle2 = wds_->GetCreditCards(&card_consumer2); |
| 572 MessageLoop::current()->Run(); | 573 MessageLoop::current()->Run(); |
| 573 EXPECT_EQ(handle2, card_consumer2.handle()); | 574 EXPECT_EQ(handle2, card_consumer2.handle()); |
| 574 ASSERT_EQ(0U, card_consumer2.result().size()); | 575 ASSERT_EQ(0U, card_consumer2.result().size()); |
| 575 } | 576 } |
| OLD | NEW |