| OLD | NEW |
| 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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "testing/gmock/include/gmock/gmock.h" | 49 #include "testing/gmock/include/gmock/gmock.h" |
| 50 #include "testing/gtest/include/gtest/gtest.h" | 50 #include "testing/gtest/include/gtest/gtest.h" |
| 51 #include "third_party/WebKit/public/web/WebAutofillClient.h" | 51 #include "third_party/WebKit/public/web/WebAutofillClient.h" |
| 52 #include "third_party/WebKit/public/web/WebFormElement.h" | 52 #include "third_party/WebKit/public/web/WebFormElement.h" |
| 53 #include "ui/base/l10n/l10n_util.h" | 53 #include "ui/base/l10n/l10n_util.h" |
| 54 #include "ui/gfx/rect.h" | 54 #include "ui/gfx/rect.h" |
| 55 #include "url/gurl.h" | 55 #include "url/gurl.h" |
| 56 | 56 |
| 57 using content::WebContents; | 57 using content::WebContents; |
| 58 using testing::_; | 58 using testing::_; |
| 59 using WebKit::WebFormElement; | 59 using blink::WebFormElement; |
| 60 | 60 |
| 61 namespace autofill { | 61 namespace autofill { |
| 62 | 62 |
| 63 typedef PersonalDataManager::GUIDPair GUIDPair; | 63 typedef PersonalDataManager::GUIDPair GUIDPair; |
| 64 | 64 |
| 65 namespace { | 65 namespace { |
| 66 | 66 |
| 67 // The page ID sent to the AutofillManager from the RenderView, used to send | 67 // The page ID sent to the AutofillManager from the RenderView, used to send |
| 68 // an IPC message back to the renderer. | 68 // an IPC message back to the renderer. |
| 69 const int kDefaultPageID = 137; | 69 const int kDefaultPageID = 137; |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 // This triggers the combined message send. | 993 // This triggers the combined message send. |
| 994 AutocompleteSuggestionsReturned(std::vector<base::string16>()); | 994 AutocompleteSuggestionsReturned(std::vector<base::string16>()); |
| 995 | 995 |
| 996 // Test that we sent the right values to the external delegate. | 996 // Test that we sent the right values to the external delegate. |
| 997 base::string16 expected_values[] = { | 997 base::string16 expected_values[] = { |
| 998 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED) | 998 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED) |
| 999 }; | 999 }; |
| 1000 base::string16 expected_labels[] = {base::string16()}; | 1000 base::string16 expected_labels[] = {base::string16()}; |
| 1001 base::string16 expected_icons[] = {base::string16()}; | 1001 base::string16 expected_icons[] = {base::string16()}; |
| 1002 int expected_unique_ids[] = | 1002 int expected_unique_ids[] = |
| 1003 {WebKit::WebAutofillClient::MenuItemIDWarningMessage}; | 1003 {blink::WebAutofillClient::MenuItemIDWarningMessage}; |
| 1004 external_delegate_->CheckSuggestions( | 1004 external_delegate_->CheckSuggestions( |
| 1005 kDefaultPageID, arraysize(expected_values), expected_values, | 1005 kDefaultPageID, arraysize(expected_values), expected_values, |
| 1006 expected_labels, expected_icons, expected_unique_ids); | 1006 expected_labels, expected_icons, expected_unique_ids); |
| 1007 | 1007 |
| 1008 // Now add some Autocomplete suggestions. We should return the autocomplete | 1008 // Now add some Autocomplete suggestions. We should return the autocomplete |
| 1009 // suggestions and the warning; these will be culled by the renderer. | 1009 // suggestions and the warning; these will be culled by the renderer. |
| 1010 const int kPageID2 = 2; | 1010 const int kPageID2 = 2; |
| 1011 GetAutofillSuggestions(kPageID2, form, field); | 1011 GetAutofillSuggestions(kPageID2, form, field); |
| 1012 | 1012 |
| 1013 std::vector<base::string16> suggestions; | 1013 std::vector<base::string16> suggestions; |
| (...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3008 test::CreateTestAddressFormData(&form); | 3008 test::CreateTestAddressFormData(&form); |
| 3009 std::vector<FormData> forms(1, form); | 3009 std::vector<FormData> forms(1, form); |
| 3010 FormsSeen(forms); | 3010 FormsSeen(forms); |
| 3011 const FormFieldData& field = form.fields[0]; | 3011 const FormFieldData& field = form.fields[0]; |
| 3012 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() | 3012 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() |
| 3013 | 3013 |
| 3014 EXPECT_TRUE(external_delegate_->on_query_seen()); | 3014 EXPECT_TRUE(external_delegate_->on_query_seen()); |
| 3015 } | 3015 } |
| 3016 | 3016 |
| 3017 } // namespace autofill | 3017 } // namespace autofill |
| OLD | NEW |