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

Unified Diff: content/renderer/password_form_conversion_utils_browsertest.cc

Issue 23622013: Move password_form_conversion_utils out of //content into //autofill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@password_form_includes_removal
Patch Set: Add bug reference for components_browsertests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/password_form_conversion_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/password_form_conversion_utils_browsertest.cc
diff --git a/content/renderer/password_form_conversion_utils_browsertest.cc b/content/renderer/password_form_conversion_utils_browsertest.cc
deleted file mode 100644
index 8cea872f746f019571938beb29c89b3be2e34b2f..0000000000000000000000000000000000000000
--- a/content/renderer/password_form_conversion_utils_browsertest.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/strings/string16.h"
-#include "base/strings/utf_string_conversions.h"
-#include "content/public/common/password_form.h"
-#include "content/public/renderer/password_form_conversion_utils.h"
-#include "content/public/test/render_view_test.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/WebVector.h"
-#include "third_party/WebKit/public/web/WebDocument.h"
-#include "third_party/WebKit/public/web/WebFormElement.h"
-#include "third_party/WebKit/public/web/WebPasswordFormData.h"
-
-using WebKit::WebFormElement;
-using WebKit::WebFrame;
-using WebKit::WebPasswordFormData;
-using WebKit::WebVector;
-
-namespace content {
-namespace {
-
-class PasswordFormConversionUtilsTest : public RenderViewTest {
- public:
- PasswordFormConversionUtilsTest() : RenderViewTest() {}
- virtual ~PasswordFormConversionUtilsTest() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PasswordFormConversionUtilsTest);
-};
-
-} // namespace
-
-TEST_F(PasswordFormConversionUtilsTest, ValidWebFormElementToPasswordForm) {
- LoadHTML("<FORM name=\"TestForm\" action=\"http://cnn.com\" method=\"post\">"
- " <INPUT type=\"text\" name=\"username\" "
- " id=\"username\" value=\"johnsmith\"/>"
- " <INPUT type=\"submit\" name=\"submit\" value=\"Submit\"/>"
- " <INPUT type=\"password\" name=\"password\" id=\"password\" "
- " value=\"secret\"/>"
- "</FORM>");
-
- WebFrame* frame = GetMainFrame();
- ASSERT_NE(static_cast<WebFrame*>(NULL), frame);
-
- WebVector<WebFormElement> forms;
- frame->document().forms(forms);
- ASSERT_EQ(1U, forms.size());
- WebPasswordFormData web_password_form(forms[0]);
- ASSERT_TRUE(web_password_form.isValid());
-
- scoped_ptr<PasswordForm> password_form = CreatePasswordForm(forms[0]);
- ASSERT_NE(static_cast<PasswordForm*>(NULL), password_form.get());
-
- EXPECT_EQ("data:", password_form->signon_realm);
- EXPECT_EQ(GURL("http://cnn.com"), password_form->action);
- EXPECT_EQ(UTF8ToUTF16("username"), password_form->username_element);
- EXPECT_EQ(UTF8ToUTF16("johnsmith"), password_form->username_value);
- EXPECT_EQ(UTF8ToUTF16("password"), password_form->password_element);
- EXPECT_EQ(UTF8ToUTF16("secret"), password_form->password_value);
- EXPECT_EQ(PasswordForm::SCHEME_HTML, password_form->scheme);
- EXPECT_FALSE(password_form->ssl_valid);
- EXPECT_FALSE(password_form->preferred);
- EXPECT_FALSE(password_form->blacklisted_by_user);
- EXPECT_EQ(PasswordForm::TYPE_MANUAL, password_form->type);
-}
-
-TEST_F(PasswordFormConversionUtilsTest, InvalidWebFormElementToPasswordForm) {
- LoadHTML("<FORM name=\"TestForm\" action=\"invalid\" method=\"post\">"
- " <INPUT type=\"text\" name=\"username\" "
- " id=\"username\" value=\"johnsmith\"/>"
- " <INPUT type=\"submit\" name=\"submit\" value=\"Submit\"/>"
- " <INPUT type=\"password\" name=\"password\" id=\"password\" "
- " value=\"secret\"/>"
- "</FORM>");
-
- WebFrame* frame = GetMainFrame();
- ASSERT_NE(static_cast<WebFrame*>(NULL), frame);
-
- WebVector<WebFormElement> forms;
- frame->document().forms(forms);
- ASSERT_EQ(1U, forms.size());
- WebPasswordFormData web_password_form(forms[0]);
- ASSERT_FALSE(web_password_form.isValid());
-
- scoped_ptr<PasswordForm> password_form = CreatePasswordForm(forms[0]);
- EXPECT_EQ(static_cast<PasswordForm*>(NULL), password_form.get());
-}
-
-} // namespace content
« no previous file with comments | « content/renderer/password_form_conversion_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698