| 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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/webdata/autofill_change.h" | 22 #include "chrome/browser/webdata/autofill_change.h" |
| 23 #include "chrome/browser/webdata/autofill_entry.h" | 23 #include "chrome/browser/webdata/autofill_entry.h" |
| 24 #include "chrome/browser/webdata/web_data_service.h" | 24 #include "chrome/browser/webdata/web_data_service.h" |
| 25 #include "chrome/browser/webdata/web_data_service_test_util.h" | 25 #include "chrome/browser/webdata/web_data_service_test_util.h" |
| 26 #include "chrome/browser/webdata/web_intents_table.h" | 26 #include "chrome/browser/webdata/web_intents_table.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/base/thread_observer_helper.h" | 30 #include "chrome/test/base/thread_observer_helper.h" |
| 31 #include "content/browser/browser_thread.h" | 31 #include "content/browser/browser_thread.h" |
| 32 #include "content/common/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/notification_details.h" | 33 #include "content/public/browser/notification_details.h" |
| 34 #include "testing/gmock/include/gmock/gmock.h" | 34 #include "testing/gmock/include/gmock/gmock.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "webkit/glue/form_field.h" | 36 #include "webkit/glue/form_field.h" |
| 37 | 37 |
| 38 using base::Time; | 38 using base::Time; |
| 39 using base::TimeDelta; | 39 using base::TimeDelta; |
| 40 using base::WaitableEvent; | 40 using base::WaitableEvent; |
| 41 using testing::_; | 41 using testing::_; |
| 42 using testing::DoDefault; | 42 using testing::DoDefault; |
| 43 using testing::ElementsAreArray; | 43 using testing::ElementsAreArray; |
| 44 using testing::Pointee; | 44 using testing::Pointee; |
| 45 using testing::Property; | 45 using testing::Property; |
| 46 | 46 |
| 47 typedef std::vector<AutofillChange> AutofillChangeList; | 47 typedef std::vector<AutofillChange> AutofillChangeList; |
| 48 | 48 |
| 49 static const int kWebDataServiceTimeoutSeconds = 8; | 49 static const int kWebDataServiceTimeoutSeconds = 8; |
| 50 | 50 |
| 51 ACTION_P(SignalEvent, event) { | 51 ACTION_P(SignalEvent, event) { |
| 52 event->Signal(); | 52 event->Signal(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 class AutofillDBThreadObserverHelper : public DBThreadObserverHelper { | 55 class AutofillDBThreadObserverHelper : public DBThreadObserverHelper { |
| 56 protected: | 56 protected: |
| 57 virtual void RegisterObservers() { | 57 virtual void RegisterObservers() { |
| 58 registrar_.Add(&observer_, | 58 registrar_.Add(&observer_, |
| 59 chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, | 59 chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, |
| 60 NotificationService::AllSources()); | 60 content::NotificationService::AllSources()); |
| 61 registrar_.Add(&observer_, | 61 registrar_.Add(&observer_, |
| 62 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, | 62 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, |
| 63 NotificationService::AllSources()); | 63 content::NotificationService::AllSources()); |
| 64 registrar_.Add(&observer_, | 64 registrar_.Add(&observer_, |
| 65 chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, | 65 chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, |
| 66 NotificationService::AllSources()); | 66 content::NotificationService::AllSources()); |
| 67 } | 67 } |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 class WebDataServiceTest : public testing::Test { | 70 class WebDataServiceTest : public testing::Test { |
| 71 public: | 71 public: |
| 72 WebDataServiceTest() | 72 WebDataServiceTest() |
| 73 : ui_thread_(BrowserThread::UI, &message_loop_), | 73 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 74 db_thread_(BrowserThread::DB) {} | 74 db_thread_(BrowserThread::DB) {} |
| 75 | 75 |
| 76 protected: | 76 protected: |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 WebIntentsConsumer::WaitUntilCalled(); | 655 WebIntentsConsumer::WaitUntilCalled(); |
| 656 ASSERT_EQ(2U, consumer.intents.size()); | 656 ASSERT_EQ(2U, consumer.intents.size()); |
| 657 | 657 |
| 658 if (consumer.intents[0].action != ASCIIToUTF16("edit")) | 658 if (consumer.intents[0].action != ASCIIToUTF16("edit")) |
| 659 std::swap(consumer.intents[0],consumer.intents[1]); | 659 std::swap(consumer.intents[0],consumer.intents[1]); |
| 660 | 660 |
| 661 EXPECT_EQ(service, consumer.intents[0]); | 661 EXPECT_EQ(service, consumer.intents[0]); |
| 662 service.action = ASCIIToUTF16("share"); | 662 service.action = ASCIIToUTF16("share"); |
| 663 EXPECT_EQ(service, consumer.intents[1]); | 663 EXPECT_EQ(service, consumer.intents[1]); |
| 664 } | 664 } |
| OLD | NEW |