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(WebDataServiceBase::ProfileErrorCallback()) { | |
Cait (Slow)
2013/03/18 16:16:37
I wonder if it's worth having a default ctor on WD
Jói
2013/03/18 23:21:23
Added such a protected constructor, so mock versio
| |
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 AutofillManager::CreateForWebContentsAndDelegate( | 254 AutofillManager::CreateForWebContentsAndDelegate( |
254 web_contents(), &manager_delegate); | 255 web_contents(), &manager_delegate); |
255 | 256 |
256 MockAutofillExternalDelegate external_delegate(web_contents()); | 257 MockAutofillExternalDelegate external_delegate(web_contents()); |
257 autocomplete_history_manager.SetExternalDelegate(&external_delegate); | 258 autocomplete_history_manager.SetExternalDelegate(&external_delegate); |
258 | 259 |
259 // Should trigger a call to OnSuggestionsReturned, verified by the mock. | 260 // Should trigger a call to OnSuggestionsReturned, verified by the mock. |
260 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); | 261 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); |
261 autocomplete_history_manager.SendSuggestions(NULL); | 262 autocomplete_history_manager.SendSuggestions(NULL); |
262 } | 263 } |
OLD | NEW |