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

Side by Side Diff: chrome/renderer/autofill/password_autofill_manager_browsertest.cc

Issue 11000016: Move forms/ out of webkit/. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Response to review Created 8 years, 2 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 (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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/common/autofill_messages.h" 7 #include "chrome/common/autofill_messages.h"
8 #include "chrome/common/form_data.h"
9 #include "chrome/common/form_field_data.h"
8 #include "chrome/renderer/autofill/autofill_agent.h" 10 #include "chrome/renderer/autofill/autofill_agent.h"
9 #include "chrome/renderer/autofill/password_autofill_manager.h" 11 #include "chrome/renderer/autofill/password_autofill_manager.h"
10 #include "chrome/test/base/chrome_render_view_test.h" 12 #include "chrome/test/base/chrome_render_view_test.h"
11 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
19 #include "ui/base/keycodes/keyboard_codes.h" 21 #include "ui/base/keycodes/keyboard_codes.h"
20 #include "webkit/forms/form_data.h"
21 #include "webkit/forms/form_field.h"
22 22
23 using webkit::forms::FormField; 23 using content::PasswordForm;
24 using webkit::forms::PasswordFormFillData;
25 using webkit::forms::PasswordForm;
26 using webkit::forms::PasswordFormDomManager;
27 using WebKit::WebDocument; 24 using WebKit::WebDocument;
28 using WebKit::WebElement; 25 using WebKit::WebElement;
29 using WebKit::WebFrame; 26 using WebKit::WebFrame;
30 using WebKit::WebInputElement; 27 using WebKit::WebInputElement;
31 using WebKit::WebString; 28 using WebKit::WebString;
32 29
33 namespace { 30 namespace {
34 31
35 // The name of the username/password element in the form. 32 // The name of the username/password element in the form.
36 const char* const kUsernameName = "username"; 33 const char* const kUsernameName = "username";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 ChromeRenderViewTest::SetUp(); 70 ChromeRenderViewTest::SetUp();
74 71
75 // Add a preferred login and an additional login to the FillData. 72 // Add a preferred login and an additional login to the FillData.
76 username1_ = ASCIIToUTF16(kAliceUsername); 73 username1_ = ASCIIToUTF16(kAliceUsername);
77 password1_ = ASCIIToUTF16(kAlicePassword); 74 password1_ = ASCIIToUTF16(kAlicePassword);
78 username2_ = ASCIIToUTF16(kBobUsername); 75 username2_ = ASCIIToUTF16(kBobUsername);
79 password2_ = ASCIIToUTF16(kBobPassword); 76 password2_ = ASCIIToUTF16(kBobPassword);
80 username3_ = ASCIIToUTF16(kCarolUsername); 77 username3_ = ASCIIToUTF16(kCarolUsername);
81 password3_ = ASCIIToUTF16(kCarolPassword); 78 password3_ = ASCIIToUTF16(kCarolPassword);
82 79
83 FormField username_field; 80 FormFieldData username_field;
84 username_field.name = ASCIIToUTF16(kUsernameName); 81 username_field.name = ASCIIToUTF16(kUsernameName);
85 username_field.value = username1_; 82 username_field.value = username1_;
86 fill_data_.basic_data.fields.push_back(username_field); 83 fill_data_.basic_data.fields.push_back(username_field);
87 84
88 FormField password_field; 85 FormFieldData password_field;
89 password_field.name = ASCIIToUTF16(kPasswordName); 86 password_field.name = ASCIIToUTF16(kPasswordName);
90 password_field.value = password1_; 87 password_field.value = password1_;
91 fill_data_.basic_data.fields.push_back(password_field); 88 fill_data_.basic_data.fields.push_back(password_field);
92 89
93 fill_data_.additional_logins[username2_] = password2_; 90 fill_data_.additional_logins[username2_] = password2_;
94 fill_data_.additional_logins[username3_] = password3_; 91 fill_data_.additional_logins[username3_] = password3_;
95 92
96 // We need to set the origin so it matches the frame URL and the action so 93 // We need to set the origin so it matches the frame URL and the action so
97 // it matches the form action, otherwise we won't autocomplete. 94 // it matches the form action, otherwise we won't autocomplete.
98 std::string origin("data:text/html;charset=utf-8,"); 95 std::string origin("data:text/html;charset=utf-8,");
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // didSelectAutofillSuggestion on the renderer. 410 // didSelectAutofillSuggestion on the renderer.
414 autofill_agent_->didSelectAutofillSuggestion(username_element_, 411 autofill_agent_->didSelectAutofillSuggestion(username_element_,
415 ASCIIToUTF16(kAliceUsername), 412 ASCIIToUTF16(kAliceUsername),
416 WebKit::WebString(), 413 WebKit::WebString(),
417 0); 414 0);
418 // Autocomplete should not have kicked in. 415 // Autocomplete should not have kicked in.
419 CheckTextFieldsState("", false, "", false); 416 CheckTextFieldsState("", false, "", false);
420 } 417 }
421 418
422 } // namespace autofill 419 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/renderer/autofill/password_autofill_manager.cc ('k') | chrome/renderer/autofill/password_generation_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698