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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/test/histogram_tester.h" | 9 #include "base/test/histogram_tester.h" |
10 #include "chrome/test/base/chrome_render_view_test.h" | 10 #include "chrome/test/base/chrome_render_view_test.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 ExpectPasswordGenerationAvailable("first_password", false); | 132 ExpectPasswordGenerationAvailable("first_password", false); |
133 | 133 |
134 // Pretend like We have received message indicating site is not blacklisted, | 134 // Pretend like We have received message indicating site is not blacklisted, |
135 // and we have received message indicating the form is classified as | 135 // and we have received message indicating the form is classified as |
136 // ACCOUNT_CREATION_FORM form Autofill server. We should show the icon. | 136 // ACCOUNT_CREATION_FORM form Autofill server. We should show the icon. |
137 LoadHTML(kAccountCreationFormHTML); | 137 LoadHTML(kAccountCreationFormHTML); |
138 SetNotBlacklistedMessage(kAccountCreationFormHTML); | 138 SetNotBlacklistedMessage(kAccountCreationFormHTML); |
139 SetAccountCreationFormsDetectedMessage(kAccountCreationFormHTML); | 139 SetAccountCreationFormsDetectedMessage(kAccountCreationFormHTML); |
140 ExpectPasswordGenerationAvailable("first_password", true); | 140 ExpectPasswordGenerationAvailable("first_password", true); |
141 | 141 |
142 // This doesn't trigger because hidden password fields are ignored. | 142 // Hidden fields are not treated differently. |
143 LoadHTML(kHiddenPasswordAccountCreationFormHTML); | 143 LoadHTML(kHiddenPasswordAccountCreationFormHTML); |
144 SetNotBlacklistedMessage(kHiddenPasswordAccountCreationFormHTML); | 144 SetNotBlacklistedMessage(kHiddenPasswordAccountCreationFormHTML); |
145 SetAccountCreationFormsDetectedMessage( | 145 SetAccountCreationFormsDetectedMessage( |
146 kHiddenPasswordAccountCreationFormHTML); | 146 kHiddenPasswordAccountCreationFormHTML); |
147 ExpectPasswordGenerationAvailable("first_password", false); | 147 ExpectPasswordGenerationAvailable("first_password", true); |
148 | 148 |
149 // This doesn't trigger because the form action is invalid. | 149 // This doesn't trigger because the form action is invalid. |
150 LoadHTML(kInvalidActionAccountCreationFormHTML); | 150 LoadHTML(kInvalidActionAccountCreationFormHTML); |
151 SetNotBlacklistedMessage(kInvalidActionAccountCreationFormHTML); | 151 SetNotBlacklistedMessage(kInvalidActionAccountCreationFormHTML); |
152 SetAccountCreationFormsDetectedMessage(kInvalidActionAccountCreationFormHTML); | 152 SetAccountCreationFormsDetectedMessage(kInvalidActionAccountCreationFormHTML); |
153 ExpectPasswordGenerationAvailable("first_password", false); | 153 ExpectPasswordGenerationAvailable("first_password", false); |
154 } | 154 } |
155 | 155 |
156 TEST_F(PasswordGenerationAgentTest, FillTest) { | 156 TEST_F(PasswordGenerationAgentTest, FillTest) { |
157 // Make sure that we are enabled before loading HTML. | 157 // Make sure that we are enabled before loading HTML. |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 "document.body.appendChild(form);"); | 407 "document.body.appendChild(form);"); |
408 ProcessPendingMessages(); | 408 ProcessPendingMessages(); |
409 // TODO(gcasto): I'm slighty worried about flakes in this test where | 409 // TODO(gcasto): I'm slighty worried about flakes in this test where |
410 // didAssociateFormControls() isn't called. If this turns out to be a problem | 410 // didAssociateFormControls() isn't called. If this turns out to be a problem |
411 // adding a call to OnDynamicFormsSeen(GetMainFrame()) will fix it, though | 411 // adding a call to OnDynamicFormsSeen(GetMainFrame()) will fix it, though |
412 // it will weaken the test. | 412 // it will weaken the test. |
413 ExpectPasswordGenerationAvailable("first_password", true); | 413 ExpectPasswordGenerationAvailable("first_password", true); |
414 } | 414 } |
415 | 415 |
416 } // namespace autofill | 416 } // namespace autofill |
OLD | NEW |