Index: components/autofill/browser/autocomplete_history_manager_unittest.cc |
diff --git a/components/autofill/browser/autocomplete_history_manager_unittest.cc b/components/autofill/browser/autocomplete_history_manager_unittest.cc |
index 0a3680d9ebde095537c09877d3f79b27a8c86520..e72084fadb9305e9abab29b74373bb24d775582c 100644 |
--- a/components/autofill/browser/autocomplete_history_manager_unittest.cc |
+++ b/components/autofill/browser/autocomplete_history_manager_unittest.cc |
@@ -17,6 +17,7 @@ |
#include "components/autofill/browser/autocomplete_history_manager.h" |
#include "components/autofill/browser/autofill_external_delegate.h" |
#include "components/autofill/browser/autofill_manager.h" |
+#include "components/autofill/browser/test_autofill_driver.h" |
#include "components/autofill/browser/test_autofill_manager_delegate.h" |
#include "components/autofill/browser/webdata/autofill_webdata_service.h" |
#include "components/autofill/common/form_data.h" |
@@ -99,7 +100,9 @@ class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness { |
web_data_service_ = new MockWebDataService(); |
WebDataServiceFactory::GetInstance()->SetTestingFactory( |
profile(), MockWebDataServiceWrapperCurrent::Build); |
- autocomplete_manager_.reset(new AutocompleteHistoryManager(web_contents())); |
+ autofill_driver_.reset(new TestAutofillDriver(web_contents())); |
+ autocomplete_manager_.reset( |
+ new AutocompleteHistoryManager(autofill_driver_.get())); |
} |
virtual void TearDown() OVERRIDE { |
@@ -110,6 +113,7 @@ class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness { |
scoped_refptr<MockWebDataService> web_data_service_; |
scoped_ptr<AutocompleteHistoryManager> autocomplete_manager_; |
+ scoped_ptr<AutofillDriver> autofill_driver_; |
MockAutofillManagerDelegate manager_delegate; |
}; |
@@ -218,33 +222,17 @@ class MockAutofillExternalDelegate : public AutofillExternalDelegate { |
DISALLOW_COPY_AND_ASSIGN(MockAutofillExternalDelegate); |
}; |
-class AutocompleteHistoryManagerStubSend : public AutocompleteHistoryManager { |
- public: |
- explicit AutocompleteHistoryManagerStubSend(WebContents* web_contents) |
- : AutocompleteHistoryManager(web_contents) {} |
- |
- // Increase visibility for testing. |
- void SendSuggestions(const std::vector<base::string16>* suggestions) { |
- AutocompleteHistoryManager::SendSuggestions(suggestions); |
- } |
- |
- // Intentionally swallow the message. |
- virtual bool Send(IPC::Message* message) OVERRIDE { |
- delete message; |
- return true; |
- } |
-}; |
- |
} // namespace |
// Make sure our external delegate is called at the right time. |
TEST_F(AutocompleteHistoryManagerTest, ExternalDelegate) { |
- // Local version with a stubbed out Send() |
- AutocompleteHistoryManagerStubSend autocomplete_history_manager( |
- web_contents()); |
+ AutocompleteHistoryManager autocomplete_history_manager( |
+ autofill_driver_.get()); |
+ autocomplete_history_manager.send_IPC_ = false; |
AutofillManager::CreateForWebContentsAndDelegate( |
web_contents(), |
+ autofill_driver_.get(), |
&manager_delegate, |
"en-US", |
AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); |