| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/prefs/testing_pref_service.h" | 8 #include "base/prefs/testing_pref_service.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
| 26 | 26 |
| 27 using content::BrowserThread; | 27 using content::BrowserThread; |
| 28 using content::WebContents; | 28 using content::WebContents; |
| 29 using testing::_; | 29 using testing::_; |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 class MockWebDataService : public WebDataService { | 33 class MockWebDataService : public WebDataService { |
| 34 public: | 34 public: |
| 35 MockWebDataService() { | 35 MockWebDataService() |
| 36 : WebDataService() { |
| 36 current_mock_web_data_service_ = this; | 37 current_mock_web_data_service_ = this; |
| 37 } | 38 } |
| 38 | 39 |
| 39 MOCK_METHOD1(AddFormFields, void(const std::vector<FormFieldData>&)); | 40 MOCK_METHOD1(AddFormFields, void(const std::vector<FormFieldData>&)); |
| 40 | 41 |
| 41 static scoped_refptr<MockWebDataService> GetCurrent() { | 42 static scoped_refptr<MockWebDataService> GetCurrent() { |
| 42 if (!current_mock_web_data_service_) { | 43 if (!current_mock_web_data_service_) { |
| 43 return new MockWebDataService(); | 44 return new MockWebDataService(); |
| 44 } | 45 } |
| 45 return current_mock_web_data_service_; | 46 return current_mock_web_data_service_; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 AutofillManager::CreateForWebContentsAndDelegate( | 256 AutofillManager::CreateForWebContentsAndDelegate( |
| 256 web_contents(), &manager_delegate); | 257 web_contents(), &manager_delegate); |
| 257 | 258 |
| 258 MockAutofillExternalDelegate external_delegate(web_contents()); | 259 MockAutofillExternalDelegate external_delegate(web_contents()); |
| 259 autocomplete_history_manager.SetExternalDelegate(&external_delegate); | 260 autocomplete_history_manager.SetExternalDelegate(&external_delegate); |
| 260 | 261 |
| 261 // Should trigger a call to OnSuggestionsReturned, verified by the mock. | 262 // Should trigger a call to OnSuggestionsReturned, verified by the mock. |
| 262 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); | 263 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); |
| 263 autocomplete_history_manager.SendSuggestions(NULL); | 264 autocomplete_history_manager.SendSuggestions(NULL); |
| 264 } | 265 } |
| OLD | NEW |