| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "content/test/test_browser_thread.h" | 36 #include "content/test/test_browser_thread.h" |
| 37 #include "googleurl/src/gurl.h" | 37 #include "googleurl/src/gurl.h" |
| 38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
| 39 #include "ipc/ipc_test_sink.h" | 39 #include "ipc/ipc_test_sink.h" |
| 40 #include "testing/gmock/include/gmock/gmock.h" | 40 #include "testing/gmock/include/gmock/gmock.h" |
| 41 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
| 42 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
| 43 #include "ui/gfx/rect.h" | 43 #include "ui/gfx/rect.h" |
| 44 #include "webkit/forms/form_data.h" | 44 #include "webkit/forms/form_data.h" |
| 45 #include "webkit/forms/form_field.h" | 45 #include "webkit/forms/form_field.h" |
| 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
| 46 | 47 |
| 47 using content::BrowserThread; | 48 using content::BrowserThread; |
| 48 using content::WebContents; | 49 using content::WebContents; |
| 49 using testing::_; | 50 using testing::_; |
| 50 using webkit::forms::FormData; | 51 using webkit::forms::FormData; |
| 51 using webkit::forms::FormField; | 52 using webkit::forms::FormField; |
| 52 | 53 |
| 53 namespace { | 54 namespace { |
| 54 | 55 |
| 55 // The page ID sent to the AutofillManager from the RenderView, used to send | 56 // The page ID sent to the AutofillManager from the RenderView, used to send |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 std::vector<string16> icons; | 905 std::vector<string16> icons; |
| 905 std::vector<int> unique_ids; | 906 std::vector<int> unique_ids; |
| 906 EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, | 907 EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, |
| 907 &unique_ids)); | 908 &unique_ids)); |
| 908 | 909 |
| 909 string16 expected_values[] = { | 910 string16 expected_values[] = { |
| 910 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED) | 911 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED) |
| 911 }; | 912 }; |
| 912 string16 expected_labels[] = {string16()}; | 913 string16 expected_labels[] = {string16()}; |
| 913 string16 expected_icons[] = {string16()}; | 914 string16 expected_icons[] = {string16()}; |
| 914 int expected_unique_ids[] = {-1}; | 915 int expected_unique_ids[] = |
| 916 {WebKit::WebAutofillClient::MenuItemIDWarningMessage}; |
| 915 ExpectSuggestions(page_id, values, labels, icons, unique_ids, | 917 ExpectSuggestions(page_id, values, labels, icons, unique_ids, |
| 916 kDefaultPageID, arraysize(expected_values), expected_values, | 918 kDefaultPageID, arraysize(expected_values), expected_values, |
| 917 expected_labels, expected_icons, expected_unique_ids); | 919 expected_labels, expected_icons, expected_unique_ids); |
| 918 | 920 |
| 919 // Now add some Autocomplete suggestions. We should return the autocomplete | 921 // Now add some Autocomplete suggestions. We should return the autocomplete |
| 920 // suggestions and the warning; these will be culled by the renderer. | 922 // suggestions and the warning; these will be culled by the renderer. |
| 921 const int kPageID2 = 2; | 923 const int kPageID2 = 2; |
| 922 GetAutofillSuggestions(kPageID2, form, field); | 924 GetAutofillSuggestions(kPageID2, form, field); |
| 923 | 925 |
| 924 std::vector<string16> suggestions; | 926 std::vector<string16> suggestions; |
| (...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2990 | 2992 |
| 2991 AutofillManager* autofill_manager = contents_wrapper()->autofill_manager(); | 2993 AutofillManager* autofill_manager = contents_wrapper()->autofill_manager(); |
| 2992 EXPECT_TRUE(autofill_manager->external_delegate()); | 2994 EXPECT_TRUE(autofill_manager->external_delegate()); |
| 2993 | 2995 |
| 2994 AutocompleteHistoryManager* autocomplete_history_manager = | 2996 AutocompleteHistoryManager* autocomplete_history_manager = |
| 2995 contents_wrapper()->autocomplete_history_manager(); | 2997 contents_wrapper()->autocomplete_history_manager(); |
| 2996 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); | 2998 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); |
| 2997 } | 2999 } |
| 2998 | 3000 |
| 2999 #endif // OS_ANDROID | 3001 #endif // OS_ANDROID |
| OLD | NEW |