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