OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ref_counted.h" | 7 #include "base/ref_counted.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/scoped_vector.h" | 9 #include "base/scoped_vector.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/tuple.h" | 13 #include "base/tuple.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/autocomplete_history_manager.h" | 15 #include "chrome/browser/autocomplete_history_manager.h" |
16 #include "chrome/browser/autofill/autofill_common_test.h" | 16 #include "chrome/browser/autofill/autofill_common_test.h" |
17 #include "chrome/browser/autofill/autofill_manager.h" | 17 #include "chrome/browser/autofill/autofill_manager.h" |
18 #include "chrome/browser/autofill/autofill_profile.h" | 18 #include "chrome/browser/autofill/autofill_profile.h" |
19 #include "chrome/browser/autofill/credit_card.h" | 19 #include "chrome/browser/autofill/credit_card.h" |
20 #include "chrome/browser/autofill/personal_data_manager.h" | 20 #include "chrome/browser/autofill/personal_data_manager.h" |
21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 23 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
24 #include "chrome/browser/tab_contents/test_tab_contents.h" | 24 #include "chrome/browser/tab_contents/test_tab_contents.h" |
25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
26 #include "chrome/common/autofill_messages.h" | 26 #include "chrome/common/autofill_messages.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/test/testing_browser_process.h" |
28 #include "chrome/test/testing_profile.h" | 29 #include "chrome/test/testing_profile.h" |
29 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
31 #include "ipc/ipc_test_sink.h" | 32 #include "ipc/ipc_test_sink.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
33 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
34 #include "webkit/glue/form_data.h" | 35 #include "webkit/glue/form_data.h" |
35 #include "webkit/glue/form_field.h" | 36 #include "webkit/glue/form_field.h" |
36 | 37 |
37 using webkit_glue::FormData; | 38 using webkit_glue::FormData; |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 if (page_id) | 554 if (page_id) |
554 *page_id = autofill_param.a; | 555 *page_id = autofill_param.a; |
555 if (results) | 556 if (results) |
556 *results = autofill_param.b; | 557 *results = autofill_param.b; |
557 | 558 |
558 process()->sink().ClearMessages(); | 559 process()->sink().ClearMessages(); |
559 return true; | 560 return true; |
560 } | 561 } |
561 | 562 |
562 protected: | 563 protected: |
| 564 ScopedTestingBrowserProcess browser_process_; |
563 scoped_ptr<TestAutoFillManager> autofill_manager_; | 565 scoped_ptr<TestAutoFillManager> autofill_manager_; |
564 scoped_refptr<TestPersonalDataManager> test_personal_data_; | 566 scoped_refptr<TestPersonalDataManager> test_personal_data_; |
565 | 567 |
566 private: | 568 private: |
567 DISALLOW_COPY_AND_ASSIGN(AutoFillManagerTest); | 569 DISALLOW_COPY_AND_ASSIGN(AutoFillManagerTest); |
568 }; | 570 }; |
569 | 571 |
570 // Test that we return all address profile suggestions when all form fields are | 572 // Test that we return all address profile suggestions when all form fields are |
571 // empty. | 573 // empty. |
572 TEST_F(AutoFillManagerTest, GetProfileSuggestionsEmptyValue) { | 574 TEST_F(AutoFillManagerTest, GetProfileSuggestionsEmptyValue) { |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 #else | 1756 #else |
1755 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( | 1757 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( |
1756 prefs::kAutoFillAuxiliaryProfilesEnabled)); | 1758 prefs::kAutoFillAuxiliaryProfilesEnabled)); |
1757 profile()->GetPrefs()->SetBoolean( | 1759 profile()->GetPrefs()->SetBoolean( |
1758 prefs::kAutoFillAuxiliaryProfilesEnabled, true); | 1760 prefs::kAutoFillAuxiliaryProfilesEnabled, true); |
1759 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); | 1761 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); |
1760 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( | 1762 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( |
1761 prefs::kAutoFillAuxiliaryProfilesEnabled)); | 1763 prefs::kAutoFillAuxiliaryProfilesEnabled)); |
1762 #endif | 1764 #endif |
1763 } | 1765 } |
OLD | NEW |