Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 159853003: Moving the autofill enum from blink side to browser side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" 26 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h"
27 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 27 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
28 #include "chrome/test/base/testing_profile.h" 28 #include "chrome/test/base/testing_profile.h"
29 #include "components/autofill/core/browser/autocomplete_history_manager.h" 29 #include "components/autofill/core/browser/autocomplete_history_manager.h"
30 #include "components/autofill/core/browser/autofill_manager.h" 30 #include "components/autofill/core/browser/autofill_manager.h"
31 #include "components/autofill/core/browser/autofill_metrics.h" 31 #include "components/autofill/core/browser/autofill_metrics.h"
32 #include "components/autofill/core/browser/autofill_profile.h" 32 #include "components/autofill/core/browser/autofill_profile.h"
33 #include "components/autofill/core/browser/autofill_test_utils.h" 33 #include "components/autofill/core/browser/autofill_test_utils.h"
34 #include "components/autofill/core/browser/credit_card.h" 34 #include "components/autofill/core/browser/credit_card.h"
35 #include "components/autofill/core/browser/personal_data_manager.h" 35 #include "components/autofill/core/browser/personal_data_manager.h"
36 #include "components/autofill/core/browser/popup_item_ids.h"
36 #include "components/autofill/core/browser/test_autofill_driver.h" 37 #include "components/autofill/core/browser/test_autofill_driver.h"
37 #include "components/autofill/core/browser/test_autofill_external_delegate.h" 38 #include "components/autofill/core/browser/test_autofill_external_delegate.h"
38 #include "components/autofill/core/browser/test_autofill_manager_delegate.h" 39 #include "components/autofill/core/browser/test_autofill_manager_delegate.h"
39 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 40 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
40 #include "components/autofill/core/common/autofill_pref_names.h" 41 #include "components/autofill/core/common/autofill_pref_names.h"
41 #include "components/autofill/core/common/form_data.h" 42 #include "components/autofill/core/common/form_data.h"
42 #include "components/autofill/core/common/form_field_data.h" 43 #include "components/autofill/core/common/form_field_data.h"
43 #include "components/autofill/core/common/forms_seen_state.h" 44 #include "components/autofill/core/common/forms_seen_state.h"
44 #include "components/user_prefs/user_prefs.h" 45 #include "components/user_prefs/user_prefs.h"
45 #include "content/public/test/mock_render_process_host.h" 46 #include "content/public/test/mock_render_process_host.h"
46 #include "content/public/test/test_utils.h" 47 #include "content/public/test/test_utils.h"
47 #include "grit/component_strings.h" 48 #include "grit/component_strings.h"
48 #include "testing/gmock/include/gmock/gmock.h" 49 #include "testing/gmock/include/gmock/gmock.h"
49 #include "testing/gtest/include/gtest/gtest.h" 50 #include "testing/gtest/include/gtest/gtest.h"
50 #include "third_party/WebKit/public/web/WebAutofillClient.h"
51 #include "ui/base/l10n/l10n_util.h" 51 #include "ui/base/l10n/l10n_util.h"
52 #include "ui/gfx/rect.h" 52 #include "ui/gfx/rect.h"
53 #include "url/gurl.h" 53 #include "url/gurl.h"
54 54
55 using base::ASCIIToUTF16; 55 using base::ASCIIToUTF16;
56 using base::UTF8ToUTF16; 56 using base::UTF8ToUTF16;
57 using content::WebContents; 57 using content::WebContents;
58 using testing::_; 58 using testing::_;
59 59
60 namespace autofill { 60 namespace autofill {
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 // No suggestions provided, so send an empty vector as the results. 909 // No suggestions provided, so send an empty vector as the results.
910 // This triggers the combined message send. 910 // This triggers the combined message send.
911 AutocompleteSuggestionsReturned(std::vector<base::string16>()); 911 AutocompleteSuggestionsReturned(std::vector<base::string16>());
912 912
913 // Test that we sent the right values to the external delegate. 913 // Test that we sent the right values to the external delegate.
914 base::string16 expected_values[] = { 914 base::string16 expected_values[] = {
915 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED) 915 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED)
916 }; 916 };
917 base::string16 expected_labels[] = {base::string16()}; 917 base::string16 expected_labels[] = {base::string16()};
918 base::string16 expected_icons[] = {base::string16()}; 918 base::string16 expected_icons[] = {base::string16()};
919 int expected_unique_ids[] = 919 int expected_unique_ids[] = {POPUP_ITEM_ID_WARNING_MESSAGE};
920 {blink::WebAutofillClient::MenuItemIDWarningMessage};
921 external_delegate_->CheckSuggestions( 920 external_delegate_->CheckSuggestions(
922 kDefaultPageID, arraysize(expected_values), expected_values, 921 kDefaultPageID, arraysize(expected_values), expected_values,
923 expected_labels, expected_icons, expected_unique_ids); 922 expected_labels, expected_icons, expected_unique_ids);
924 923
925 // Now add some Autocomplete suggestions. We should return the autocomplete 924 // Now add some Autocomplete suggestions. We should return the autocomplete
926 // suggestions and the warning; these will be culled by the renderer. 925 // suggestions and the warning; these will be culled by the renderer.
927 const int kPageID2 = 2; 926 const int kPageID2 = 2;
928 GetAutofillSuggestions(kPageID2, form, field); 927 GetAutofillSuggestions(kPageID2, form, field);
929 928
930 std::vector<base::string16> suggestions; 929 std::vector<base::string16> suggestions;
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 test::CreateTestAddressFormData(&form); 2912 test::CreateTestAddressFormData(&form);
2914 std::vector<FormData> forms(1, form); 2913 std::vector<FormData> forms(1, form);
2915 FormsSeen(forms); 2914 FormsSeen(forms);
2916 const FormFieldData& field = form.fields[0]; 2915 const FormFieldData& field = form.fields[0];
2917 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 2916 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
2918 2917
2919 EXPECT_TRUE(external_delegate_->on_query_seen()); 2918 EXPECT_TRUE(external_delegate_->on_query_seen());
2920 } 2919 }
2921 2920
2922 } // namespace autofill 2921 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | components/autofill/core/browser/popup_item_ids.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698