| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/keyboard_codes.h" | 5 #include "app/keyboard_codes.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/renderer/password_autocomplete_manager.h" | 8 #include "chrome/renderer/password_autocomplete_manager.h" |
| 9 #include "chrome/test/render_view_test.h" | 9 #include "chrome/test/render_view_test.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 const char* const kCarolPassword = "test"; | 42 const char* const kCarolPassword = "test"; |
| 43 | 43 |
| 44 | 44 |
| 45 const char* const kFormHTML = | 45 const char* const kFormHTML = |
| 46 "<FORM name='LoginTestForm' action='http://www.bidule.com'>" | 46 "<FORM name='LoginTestForm' action='http://www.bidule.com'>" |
| 47 " <INPUT type='text' id='username'/>" | 47 " <INPUT type='text' id='username'/>" |
| 48 " <INPUT type='password' id='password'/>" | 48 " <INPUT type='password' id='password'/>" |
| 49 " <INPUT type='submit' value='Login'/>" | 49 " <INPUT type='submit' value='Login'/>" |
| 50 "</FORM>"; | 50 "</FORM>"; |
| 51 | 51 |
| 52 } // namespace |
| 53 |
| 52 class PasswordAutocompleteManagerTest : public RenderViewTest { | 54 class PasswordAutocompleteManagerTest : public RenderViewTest { |
| 53 public: | 55 public: |
| 54 PasswordAutocompleteManagerTest() { | 56 PasswordAutocompleteManagerTest() { |
| 55 } | 57 } |
| 56 | 58 |
| 57 // Simulates the fill password form message being sent to the renderer. | 59 // Simulates the fill password form message being sent to the renderer. |
| 58 // We use that so we don't have to make RenderView::OnFillPasswordForm() | 60 // We use that so we don't have to make RenderView::OnFillPasswordForm() |
| 59 // protected. | 61 // protected. |
| 60 void SimulateOnFillPasswordForm( | 62 void SimulateOnFillPasswordForm( |
| 61 const PasswordFormFillData& fill_data) { | 63 const PasswordFormFillData& fill_data) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 324 |
| 323 // To simulate a selection in the suggestion drop-down we just mimick what the | 325 // To simulate a selection in the suggestion drop-down we just mimick what the |
| 324 // WebView does: it sets the element value then calls | 326 // WebView does: it sets the element value then calls |
| 325 // didAcceptAutocompleteSuggestion on the renderer. | 327 // didAcceptAutocompleteSuggestion on the renderer. |
| 326 username_element_.setValue(ASCIIToUTF16(kAliceUsername)); | 328 username_element_.setValue(ASCIIToUTF16(kAliceUsername)); |
| 327 view_->didAcceptAutocompleteSuggestion(username_element_); | 329 view_->didAcceptAutocompleteSuggestion(username_element_); |
| 328 | 330 |
| 329 // Autocomplete should have kicked in. | 331 // Autocomplete should have kicked in. |
| 330 CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true); | 332 CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true); |
| 331 } | 333 } |
| 332 | |
| 333 } | |
| OLD | NEW |