| 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" | |
| 29 #include "chrome/test/testing_profile.h" | 28 #include "chrome/test/testing_profile.h" |
| 30 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
| 31 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
| 32 #include "ipc/ipc_test_sink.h" | 31 #include "ipc/ipc_test_sink.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "webkit/glue/form_data.h" | 34 #include "webkit/glue/form_data.h" |
| 36 #include "webkit/glue/form_field.h" | 35 #include "webkit/glue/form_field.h" |
| 37 | 36 |
| 38 using webkit_glue::FormData; | 37 using webkit_glue::FormData; |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 if (page_id) | 553 if (page_id) |
| 555 *page_id = autofill_param.a; | 554 *page_id = autofill_param.a; |
| 556 if (results) | 555 if (results) |
| 557 *results = autofill_param.b; | 556 *results = autofill_param.b; |
| 558 | 557 |
| 559 process()->sink().ClearMessages(); | 558 process()->sink().ClearMessages(); |
| 560 return true; | 559 return true; |
| 561 } | 560 } |
| 562 | 561 |
| 563 protected: | 562 protected: |
| 564 ScopedTestingBrowserProcess browser_process_; | |
| 565 scoped_ptr<TestAutoFillManager> autofill_manager_; | 563 scoped_ptr<TestAutoFillManager> autofill_manager_; |
| 566 scoped_refptr<TestPersonalDataManager> test_personal_data_; | 564 scoped_refptr<TestPersonalDataManager> test_personal_data_; |
| 567 | 565 |
| 568 private: | 566 private: |
| 569 DISALLOW_COPY_AND_ASSIGN(AutoFillManagerTest); | 567 DISALLOW_COPY_AND_ASSIGN(AutoFillManagerTest); |
| 570 }; | 568 }; |
| 571 | 569 |
| 572 // Test that we return all address profile suggestions when all form fields are | 570 // Test that we return all address profile suggestions when all form fields are |
| 573 // empty. | 571 // empty. |
| 574 TEST_F(AutoFillManagerTest, GetProfileSuggestionsEmptyValue) { | 572 TEST_F(AutoFillManagerTest, GetProfileSuggestionsEmptyValue) { |
| (...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 #else | 1754 #else |
| 1757 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( | 1755 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( |
| 1758 prefs::kAutoFillAuxiliaryProfilesEnabled)); | 1756 prefs::kAutoFillAuxiliaryProfilesEnabled)); |
| 1759 profile()->GetPrefs()->SetBoolean( | 1757 profile()->GetPrefs()->SetBoolean( |
| 1760 prefs::kAutoFillAuxiliaryProfilesEnabled, true); | 1758 prefs::kAutoFillAuxiliaryProfilesEnabled, true); |
| 1761 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); | 1759 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); |
| 1762 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( | 1760 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( |
| 1763 prefs::kAutoFillAuxiliaryProfilesEnabled)); | 1761 prefs::kAutoFillAuxiliaryProfilesEnabled)); |
| 1764 #endif | 1762 #endif |
| 1765 } | 1763 } |
| OLD | NEW |