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

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 & incorporated review comments 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 "third_party/WebKit/public/web/WebFormElement.h" 51 #include "third_party/WebKit/public/web/WebFormElement.h"
52 #include "ui/base/l10n/l10n_util.h" 52 #include "ui/base/l10n/l10n_util.h"
53 #include "ui/gfx/rect.h" 53 #include "ui/gfx/rect.h"
54 #include "url/gurl.h" 54 #include "url/gurl.h"
55 55
56 using base::ASCIIToUTF16; 56 using base::ASCIIToUTF16;
57 using base::UTF8ToUTF16; 57 using base::UTF8ToUTF16;
58 using content::WebContents; 58 using content::WebContents;
59 using blink::WebFormElement; 59 using blink::WebFormElement;
60 using testing::_; 60 using testing::_;
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 // No suggestions provided, so send an empty vector as the results. 919 // No suggestions provided, so send an empty vector as the results.
920 // This triggers the combined message send. 920 // This triggers the combined message send.
921 AutocompleteSuggestionsReturned(std::vector<base::string16>()); 921 AutocompleteSuggestionsReturned(std::vector<base::string16>());
922 922
923 // Test that we sent the right values to the external delegate. 923 // Test that we sent the right values to the external delegate.
924 base::string16 expected_values[] = { 924 base::string16 expected_values[] = {
925 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED) 925 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED)
926 }; 926 };
927 base::string16 expected_labels[] = {base::string16()}; 927 base::string16 expected_labels[] = {base::string16()};
928 base::string16 expected_icons[] = {base::string16()}; 928 base::string16 expected_icons[] = {base::string16()};
929 int expected_unique_ids[] = 929 int expected_unique_ids[] = {POPUP_ITEM_ID_WARNING_MESSAGE};
930 {blink::WebAutofillClient::MenuItemIDWarningMessage};
931 external_delegate_->CheckSuggestions( 930 external_delegate_->CheckSuggestions(
932 kDefaultPageID, arraysize(expected_values), expected_values, 931 kDefaultPageID, arraysize(expected_values), expected_values,
933 expected_labels, expected_icons, expected_unique_ids); 932 expected_labels, expected_icons, expected_unique_ids);
934 933
935 // Now add some Autocomplete suggestions. We should return the autocomplete 934 // Now add some Autocomplete suggestions. We should return the autocomplete
936 // suggestions and the warning; these will be culled by the renderer. 935 // suggestions and the warning; these will be culled by the renderer.
937 const int kPageID2 = 2; 936 const int kPageID2 = 2;
938 GetAutofillSuggestions(kPageID2, form, field); 937 GetAutofillSuggestions(kPageID2, form, field);
939 938
940 std::vector<base::string16> suggestions; 939 std::vector<base::string16> suggestions;
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2923 test::CreateTestAddressFormData(&form); 2922 test::CreateTestAddressFormData(&form);
2924 std::vector<FormData> forms(1, form); 2923 std::vector<FormData> forms(1, form);
2925 FormsSeen(forms); 2924 FormsSeen(forms);
2926 const FormFieldData& field = form.fields[0]; 2925 const FormFieldData& field = form.fields[0];
2927 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 2926 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
2928 2927
2929 EXPECT_TRUE(external_delegate_->on_query_seen()); 2928 EXPECT_TRUE(external_delegate_->on_query_seen());
2930 } 2929 }
2931 2930
2932 } // namespace autofill 2931 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698