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

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

Issue 23742004: Move PasswordForm from //content to //autofill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_password_form_conversion_utils
Patch Set: Rebase Created 7 years, 3 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/strings/string_util.h" 5 #include "base/strings/string_util.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/test/base/chrome_render_view_test.h" 7 #include "chrome/test/base/chrome_render_view_test.h"
8 #include "components/autofill/content/renderer/autofill_agent.h" 8 #include "components/autofill/content/renderer/autofill_agent.h"
9 #include "components/autofill/content/renderer/form_autofill_util.h" 9 #include "components/autofill/content/renderer/form_autofill_util.h"
10 #include "components/autofill/content/renderer/password_autofill_agent.h" 10 #include "components/autofill/content/renderer/password_autofill_agent.h"
11 #include "components/autofill/content/renderer/test_password_autofill_agent.h" 11 #include "components/autofill/content/renderer/test_password_autofill_agent.h"
12 #include "components/autofill/core/common/autofill_messages.h" 12 #include "components/autofill/core/common/autofill_messages.h"
13 #include "components/autofill/core/common/form_data.h" 13 #include "components/autofill/core/common/form_data.h"
14 #include "components/autofill/core/common/form_field_data.h" 14 #include "components/autofill/core/common/form_field_data.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "third_party/WebKit/public/platform/WebString.h" 16 #include "third_party/WebKit/public/platform/WebString.h"
17 #include "third_party/WebKit/public/platform/WebVector.h" 17 #include "third_party/WebKit/public/platform/WebVector.h"
18 #include "third_party/WebKit/public/web/WebDocument.h" 18 #include "third_party/WebKit/public/web/WebDocument.h"
19 #include "third_party/WebKit/public/web/WebElement.h" 19 #include "third_party/WebKit/public/web/WebElement.h"
20 #include "third_party/WebKit/public/web/WebFormElement.h" 20 #include "third_party/WebKit/public/web/WebFormElement.h"
21 #include "third_party/WebKit/public/web/WebInputElement.h" 21 #include "third_party/WebKit/public/web/WebInputElement.h"
22 #include "third_party/WebKit/public/web/WebNode.h" 22 #include "third_party/WebKit/public/web/WebNode.h"
23 #include "third_party/WebKit/public/web/WebView.h" 23 #include "third_party/WebKit/public/web/WebView.h"
24 #include "ui/base/keycodes/keyboard_codes.h" 24 #include "ui/base/keycodes/keyboard_codes.h"
25 25
26 using content::PasswordForm; 26 using autofill::PasswordForm;
27 using WebKit::WebDocument; 27 using WebKit::WebDocument;
28 using WebKit::WebElement; 28 using WebKit::WebElement;
29 using WebKit::WebFrame; 29 using WebKit::WebFrame;
30 using WebKit::WebInputElement; 30 using WebKit::WebInputElement;
31 using WebKit::WebString; 31 using WebKit::WebString;
32 using WebKit::WebView; 32 using WebKit::WebView;
33 33
34 namespace { 34 namespace {
35 35
36 // The name of the username/password element in the form. 36 // The name of the username/password element in the form.
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 ASSERT_EQ(1u, forms3.size()); 547 ASSERT_EQ(1u, forms3.size());
548 EXPECT_FALSE(IsWebNodeVisible(forms3[0])); 548 EXPECT_FALSE(IsWebNodeVisible(forms3[0]));
549 } 549 }
550 550
551 TEST_F(PasswordAutofillAgentTest, SendPasswordFormsTest) { 551 TEST_F(PasswordAutofillAgentTest, SendPasswordFormsTest) {
552 render_thread_->sink().ClearMessages(); 552 render_thread_->sink().ClearMessages();
553 LoadHTML(kVisibleFormHTML); 553 LoadHTML(kVisibleFormHTML);
554 const IPC::Message* message = render_thread_->sink() 554 const IPC::Message* message = render_thread_->sink()
555 .GetFirstMessageMatching(AutofillHostMsg_PasswordFormsRendered::ID); 555 .GetFirstMessageMatching(AutofillHostMsg_PasswordFormsRendered::ID);
556 EXPECT_TRUE(message); 556 EXPECT_TRUE(message);
557 Tuple1<std::vector<content::PasswordForm> > param; 557 Tuple1<std::vector<autofill::PasswordForm> > param;
558 AutofillHostMsg_PasswordFormsRendered::Read(message, &param); 558 AutofillHostMsg_PasswordFormsRendered::Read(message, &param);
559 EXPECT_TRUE(param.a.size()); 559 EXPECT_TRUE(param.a.size());
560 560
561 render_thread_->sink().ClearMessages(); 561 render_thread_->sink().ClearMessages();
562 LoadHTML(kEmptyFormHTML); 562 LoadHTML(kEmptyFormHTML);
563 message = render_thread_->sink().GetFirstMessageMatching( 563 message = render_thread_->sink().GetFirstMessageMatching(
564 AutofillHostMsg_PasswordFormsRendered::ID); 564 AutofillHostMsg_PasswordFormsRendered::ID);
565 EXPECT_TRUE(message); 565 EXPECT_TRUE(message);
566 AutofillHostMsg_PasswordFormsRendered::Read(message, &param); 566 AutofillHostMsg_PasswordFormsRendered::Read(message, &param);
567 EXPECT_FALSE(param.a.size()); 567 EXPECT_FALSE(param.a.size());
568 568
569 render_thread_->sink().ClearMessages(); 569 render_thread_->sink().ClearMessages();
570 LoadHTML(kNonVisibleFormHTML); 570 LoadHTML(kNonVisibleFormHTML);
571 message = render_thread_->sink().GetFirstMessageMatching( 571 message = render_thread_->sink().GetFirstMessageMatching(
572 AutofillHostMsg_PasswordFormsRendered::ID); 572 AutofillHostMsg_PasswordFormsRendered::ID);
573 EXPECT_TRUE(message); 573 EXPECT_TRUE(message);
574 AutofillHostMsg_PasswordFormsRendered::Read(message, &param); 574 AutofillHostMsg_PasswordFormsRendered::Read(message, &param);
575 EXPECT_FALSE(param.a.size()); 575 EXPECT_FALSE(param.a.size());
576 } 576 }
577 577
578 } // namespace autofill 578 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698