summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-11 19:20:40 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-11 19:20:40 +0000
commitae2da21de4fc55a6e0bcc67ecdbccef29bea1a25 (patch)
tree5e8f0c15162f6d38c9f514a527a5354b678fd8a7 /webkit
parent52a03d86e102837f2c2eca3a08617c7350a21f83 (diff)
downloadchromium_src-ae2da21de4fc55a6e0bcc67ecdbccef29bea1a25.zip
chromium_src-ae2da21de4fc55a6e0bcc67ecdbccef29bea1a25.tar.gz
chromium_src-ae2da21de4fc55a6e0bcc67ecdbccef29bea1a25.tar.bz2
Remove obsolete webpasswordautocompletelistener files
BUG=none TEST=none Review URL: http://codereview.chromium.org/6674013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webkit_glue.gypi2
-rw-r--r--webkit/glue/webpasswordautocompletelistener_impl.cc224
-rw-r--r--webkit/glue/webpasswordautocompletelistener_impl.h87
-rw-r--r--webkit/glue/webpasswordautocompletelistener_unittest.cc345
-rw-r--r--webkit/tools/test_shell/test_shell.gypi1
5 files changed, 0 insertions, 659 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index e742b8f..83395d3 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -441,8 +441,6 @@
'webmenuitem.h',
'webmenurunner_mac.h',
'webmenurunner_mac.mm',
- 'webpasswordautocompletelistener_impl.cc',
- 'webpasswordautocompletelistener_impl.h',
'webpreferences.cc',
'webpreferences.h',
'websocketstreamhandle_bridge.h',
diff --git a/webkit/glue/webpasswordautocompletelistener_impl.cc b/webkit/glue/webpasswordautocompletelistener_impl.cc
deleted file mode 100644
index f584532..0000000
--- a/webkit/glue/webpasswordautocompletelistener_impl.cc
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright (c) 2006-2008 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.
-//
-// This file provides the implementaiton of the password manager's autocomplete
-// component.
-
-#include "webkit/glue/webpasswordautocompletelistener_impl.h"
-
-#include <vector>
-
-#include "base/string_util.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
-
-using WebKit::WebFrame;
-using WebKit::WebView;
-
-namespace webkit_glue {
-
-WebInputElementDelegate::WebInputElementDelegate() {
-}
-
-WebInputElementDelegate::WebInputElementDelegate(const WebInputElement& element)
- : element_(element) {
-}
-
-WebInputElementDelegate::~WebInputElementDelegate() {
-}
-
-bool WebInputElementDelegate::IsEditable() const {
- return element_.isEnabledFormControl() && !element_.hasAttribute("readonly");
-}
-
-bool WebInputElementDelegate::IsValidValue(const string16& value) {
- return element_.isValidValue(value);
-}
-
-void WebInputElementDelegate::SetValue(const string16& value) {
- element_.setValue(value);
-}
-
-bool WebInputElementDelegate::IsAutofilled() const {
- return element_.isAutofilled();
-}
-
-void WebInputElementDelegate::SetAutofilled(bool autofilled) {
- if (element_.isAutofilled() == autofilled)
- return;
- element_.setAutofilled(autofilled);
- // Notify any changeEvent listeners.
- element_.dispatchFormControlChangeEvent();
-}
-
-void WebInputElementDelegate::SetSelectionRange(size_t start, size_t end) {
- element_.setSelectionRange(start, end);
-}
-
-void WebInputElementDelegate::RefreshAutoFillPopup(
- const std::vector<string16>& suggestions) {
- WebView* webview = element_.document().frame()->view();
- if (webview) {
- std::vector<string16> names;
- std::vector<string16> labels;
- std::vector<string16> icons;
- std::vector<int> unique_ids;
-
- for (size_t i = 0; i < suggestions.size(); ++i) {
- names.push_back(suggestions[i]);
- labels.push_back(string16());
- icons.push_back(string16());
- unique_ids.push_back(0);
- }
-
- webview->applyAutoFillSuggestions(
- element_, names, labels, icons, unique_ids, -1);
- }
-}
-
-void WebInputElementDelegate::HideAutoFillPopup() {
- WebView* webview = element_.document().frame()->view();
- if (webview) {
- webview->hidePopups();
- }
-}
-
-WebPasswordAutocompleteListenerImpl::WebPasswordAutocompleteListenerImpl(
- WebInputElementDelegate* username_delegate,
- WebInputElementDelegate* password_delegate,
- const PasswordFormFillData& data)
- : password_delegate_(password_delegate),
- username_delegate_(username_delegate),
- data_(data) {
-}
-
-WebPasswordAutocompleteListenerImpl::~WebPasswordAutocompleteListenerImpl() {
-}
-
-void WebPasswordAutocompleteListenerImpl::didBlurInputElement(
- const WebString& user_input) {
- // If this listener exists, its because the password manager had more than
- // one match for the password form, which implies it had at least one
- // [preferred] username/password pair.
-// DCHECK(data_.basic_data.values.size() == 2);
-
- if (!password_delegate_->IsEditable())
- return;
-
- string16 user_input16 = user_input;
-
- // If enabled, set the password field to match the current username.
- if (data_.basic_data.fields[0].value == user_input16) {
- if (password_delegate_->IsValidValue(data_.basic_data.fields[1].value)) {
- // Preferred username/login is selected.
- password_delegate_->SetValue(data_.basic_data.fields[1].value);
- password_delegate_->SetAutofilled(true);
- }
- } else if (data_.additional_logins.find(user_input16) !=
- data_.additional_logins.end()) {
- if (password_delegate_->IsValidValue(
- data_.additional_logins[user_input16])) {
- // One of the extra username/logins is selected.
- password_delegate_->SetValue(data_.additional_logins[user_input16]);
- password_delegate_->SetAutofilled(true);
- }
- }
-}
-
-void WebPasswordAutocompleteListenerImpl::performInlineAutocomplete(
- const WebString& user_input,
- bool backspace_or_delete_pressed,
- bool show_suggestions) {
- // If wait_for_username is true, we only autofill the password when the
- // username field is blurred (i.e not inline) with a matching username string
- // entered.
- if (data_.wait_for_username)
- return;
-
- string16 user_input16 = user_input;
-
- // The input text is being changed, so any autofilled password is now
- // outdated.
- username_delegate_->SetAutofilled(false);
- if (password_delegate_->IsAutofilled()) {
- password_delegate_->SetValue(string16());
- password_delegate_->SetAutofilled(false);
- }
-
- if (show_suggestions && !showSuggestionPopup(user_input16))
- username_delegate_->HideAutoFillPopup();
-
- if (backspace_or_delete_pressed)
- return; // Don't inline autocomplete when the user deleted something.
-
- // Look for any suitable matches to current field text.
- // TODO(timsteele): The preferred login (in basic_data.values) and additional
- // logins could be bundled into the same data structure (possibly even as
- // WebCore strings) upon construction of the PasswordAutocompleteListenerImpl
- // to simplify lookup and save string conversions (see SetValue) on each
- // successful call to OnInlineAutocompleteNeeded.
- if (TryToMatch(user_input16,
- data_.basic_data.fields[0].value,
- data_.basic_data.fields[1].value)) {
- return;
- }
-
- // Scan additional logins for a match.
- for (PasswordFormFillData::LoginCollection::iterator it =
- data_.additional_logins.begin();
- it != data_.additional_logins.end();
- ++it) {
- if (TryToMatch(user_input16, it->first, it->second))
- return;
- }
-}
-
-bool WebPasswordAutocompleteListenerImpl::showSuggestionPopup(
- const WebString& value) {
- std::vector<string16> suggestions;
- GetSuggestions(value, &suggestions);
- if (suggestions.empty())
- return false;
-
- username_delegate_->RefreshAutoFillPopup(suggestions);
- return true;
-}
-
-bool WebPasswordAutocompleteListenerImpl::TryToMatch(const string16& input,
- const string16& username,
- const string16& password) {
- if (!StartsWith(username, input, false))
- return false;
-
- if (!username_delegate_->IsValidValue(username))
- return false;
-
- // Input matches the username, fill in required values.
- username_delegate_->SetValue(username);
- username_delegate_->SetSelectionRange(input.length(), username.length());
- username_delegate_->SetAutofilled(true);
- if (password_delegate_->IsEditable() &&
- password_delegate_->IsValidValue(password)) {
- password_delegate_->SetValue(password);
- password_delegate_->SetAutofilled(true);
- }
- return true;
-}
-
-void WebPasswordAutocompleteListenerImpl::GetSuggestions(
- const string16& input, std::vector<string16>* suggestions) {
- if (StartsWith(data_.basic_data.fields[0].value, input, false))
- suggestions->push_back(data_.basic_data.fields[0].value);
-
- for (PasswordFormFillData::LoginCollection::iterator it =
- data_.additional_logins.begin();
- it != data_.additional_logins.end();
- ++it) {
- if (StartsWith(it->first, input, false))
- suggestions->push_back(it->first);
- }
-}
-
-} // namespace webkit_glue
diff --git a/webkit/glue/webpasswordautocompletelistener_impl.h b/webkit/glue/webpasswordautocompletelistener_impl.h
deleted file mode 100644
index 067c6c2a..0000000
--- a/webkit/glue/webpasswordautocompletelistener_impl.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2006-2008 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.
-//
-// A concrete definition of the DOM autocomplete framework defined by
-// autocomplete_input_listener.h, for the password manager.
-
-#ifndef WEBKIT_GLUE_PASSWORDAUTOCOMPLETELISTENER_IMPL_H_
-#define WEBKIT_GLUE_PASSWORDAUTOCOMPLETELISTENER_IMPL_H_
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordAutocompleteListener.h"
-#include "webkit/glue/password_form_dom_manager.h"
-
-using WebKit::WebInputElement;
-using WebKit::WebString;
-
-namespace webkit_glue {
-
-// A proxy interface to a WebInputElement for inline autocomplete. The proxy
-// is overridden by webpasswordautocompletelistener_unittest.
-class WebInputElementDelegate {
- public:
- WebInputElementDelegate();
- WebInputElementDelegate(const WebInputElement& element);
- virtual ~WebInputElementDelegate();
-
- // These are virtual to support unit testing.
- virtual bool IsEditable() const;
- virtual bool IsValidValue(const string16& value);
- virtual void SetValue(const string16& value);
- virtual bool IsAutofilled() const;
- virtual void SetAutofilled(bool autofilled);
- virtual void SetSelectionRange(size_t start, size_t end);
- virtual void RefreshAutoFillPopup(const std::vector<string16>& suggestions);
- virtual void HideAutoFillPopup();
-
- private:
- // The underlying DOM element we're wrapping.
- WebInputElement element_;
-
- DISALLOW_COPY_AND_ASSIGN(WebInputElementDelegate);
-};
-
-class WebPasswordAutocompleteListenerImpl :
- public WebKit::WebPasswordAutocompleteListener {
- public:
- WebPasswordAutocompleteListenerImpl(
- WebInputElementDelegate* username_element,
- WebInputElementDelegate* password_element,
- const PasswordFormFillData& data);
- virtual ~WebPasswordAutocompleteListenerImpl();
-
- // WebKit::PasswordAutocompleteListener methods:
- virtual void didBlurInputElement(const WebString& user_input);
- virtual void performInlineAutocomplete(const WebString& user_input,
- bool backspace_or_delete_pressed,
- bool show_suggestions);
- virtual bool showSuggestionPopup(const WebString& value);
-
- private:
- // Check if the input string resembles a potential matching login
- // (username/password) and if so, match them up by autocompleting the edit
- // delegates.
- bool TryToMatch(const string16& input,
- const string16& username,
- const string16& password);
-
- // Scan |data_| for prefix matches of |input| and add each to |suggestions|.
- void GetSuggestions(const string16& input,
- std::vector<string16>* suggestions);
-
- // Access to password field to autocomplete on blur/username updates.
- scoped_ptr<WebInputElementDelegate> password_delegate_;
- scoped_ptr<WebInputElementDelegate> username_delegate_;
-
- // Contains the extra logins for matching on delta/blur.
- PasswordFormFillData data_;
-
- DISALLOW_COPY_AND_ASSIGN(WebPasswordAutocompleteListenerImpl);
-};
-
-} // webkit_glue
-
-#endif // WEBKIT_GLUE_PASSWORD_AUTOCOMPLETE_LISTENER_H_
diff --git a/webkit/glue/webpasswordautocompletelistener_unittest.cc b/webkit/glue/webpasswordautocompletelistener_unittest.cc
deleted file mode 100644
index 2eeb890..0000000
--- a/webkit/glue/webpasswordautocompletelistener_unittest.cc
+++ /dev/null
@@ -1,345 +0,0 @@
-// Copyright (c) 2006-2009 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.
-//
-// The PasswordManagerAutocompleteTests in this file test only the
-// PasswordAutocompleteListener class implementation (and not any of the
-// higher level dom autocomplete framework).
-
-#include <string>
-
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/glue/form_field.h"
-#include "webkit/glue/webpasswordautocompletelistener_impl.h"
-
-using WebKit::WebString;
-using webkit_glue::FormField;
-using webkit_glue::PasswordFormDomManager;
-using webkit_glue::PasswordFormFillData;
-using webkit_glue::WebInputElementDelegate;
-using webkit_glue::WebPasswordAutocompleteListenerImpl;
-
-class TestWebInputElementDelegate : public WebInputElementDelegate {
- public:
- TestWebInputElementDelegate()
- : WebInputElementDelegate(),
- selection_start_(0),
- selection_end_(0),
- is_editable_(true),
- is_valid_(true),
- is_autofilled_(false) {
- }
-
- // Override those methods we implicitly invoke in the tests.
- virtual bool IsEditable() const {
- return is_editable_;
- }
-
- virtual bool IsValidValue(const string16& value) {
- return is_valid_;
- }
-
- virtual void SetValue(const string16& value) {
- value_ = value;
- }
-
- virtual bool IsAutofilled() const { return is_autofilled_; }
-
- virtual void SetAutofilled(bool autofilled) {
- is_autofilled_ = autofilled;
- }
-
- virtual void SetSelectionRange(size_t start, size_t end) {
- selection_start_ = start;
- selection_end_ = end;
- }
-
- // Testing-only methods.
- void set_is_editable(bool editable) {
- is_editable_ = editable;
- }
-
- void set_is_valid(bool valid) {
- is_valid_ = valid;
- }
-
- string16 value() const {
- return value_;
- }
-
- size_t selection_start() const {
- return selection_start_;
- }
-
- size_t selection_end() const {
- return selection_end_;
- }
-
- private:
- string16 value_;
- size_t selection_start_;
- size_t selection_end_;
- bool is_editable_;
- bool is_valid_;
- bool is_autofilled_;
-};
-
-namespace {
-class PasswordManagerAutocompleteTests : public testing::Test {
- public:
- PasswordManagerAutocompleteTests()
- : username_delegate_(NULL),
- password_delegate_(NULL) {
- }
-
- virtual void SetUp() {
- // Add a preferred login and an additional login to the FillData.
- username1_ = ASCIIToUTF16("alice");
- password1_ = ASCIIToUTF16("password");
- username2_ = ASCIIToUTF16("bob");
- password2_ = ASCIIToUTF16("bobsyouruncle");
- data_.basic_data.fields.push_back(FormField(string16(),
- string16(),
- username1_,
- string16(),
- 0,
- false));
- data_.basic_data.fields.push_back(FormField(string16(),
- string16(),
- password1_,
- string16(),
- 0,
- false));
- data_.additional_logins[username2_] = password2_;
-
- username_delegate_ = new TestWebInputElementDelegate();
- password_delegate_ = new TestWebInputElementDelegate();
-
- testing::Test::SetUp();
- }
-
- protected:
- // Create the WebPasswordAutocompleteListener associated with
- // username_delegate_ and password_delegate_, should be called only once at
- // the begining of the test.
- WebKit::WebPasswordAutocompleteListener* CreateListener(
- bool wait_for_username) {
- DCHECK(!listener_.get());
- data_.wait_for_username = wait_for_username;
- listener_.reset(new WebPasswordAutocompleteListenerImpl(username_delegate_,
- password_delegate_,
- data_));
- return listener_.get();
- }
-
- string16 username1_;
- string16 password1_;
- string16 username2_;
- string16 password2_;
- PasswordFormFillData data_;
- TestWebInputElementDelegate* username_delegate_;
- TestWebInputElementDelegate* password_delegate_;
-
- private:
- scoped_ptr<WebPasswordAutocompleteListenerImpl> listener_;
-};
-
-TEST_F(PasswordManagerAutocompleteTests, OnBlur) {
- WebKit::WebPasswordAutocompleteListener* listener = CreateListener(false);
-
- // Make the password field read-only.
- password_delegate_->set_is_editable(false);
- // Simulate a blur event on the username field, but r/o password won't fill.
- listener->didBlurInputElement(username1_);
- EXPECT_TRUE(password_delegate_->value().empty());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
- password_delegate_->set_is_editable(true);
-
- // Simulate a blur event on the username field and expect a password autofill.
- listener->didBlurInputElement(username1_);
- EXPECT_EQ(password1_, password_delegate_->value());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
-
- // Now the user goes back and changes the username to something we don't
- // have saved. The password should remain unchanged.
- listener->didBlurInputElement(ASCIIToUTF16("blahblahblah"));
- EXPECT_EQ(password1_, password_delegate_->value());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
-
- // Now they type in the additional login username.
- listener->didBlurInputElement(username2_);
- EXPECT_EQ(password2_, password_delegate_->value());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
-}
-
-TEST_F(PasswordManagerAutocompleteTests, OnInlineAutocompleteNeeded) {
- WebKit::WebPasswordAutocompleteListener* listener = CreateListener(false);
-
- // Simulate the user typing in the first letter of 'alice', a stored username.
- listener->performInlineAutocomplete(ASCIIToUTF16("a"), false, false);
- // Both the username and password delegates should reflect selection
- // of the stored login.
- EXPECT_EQ(username1_, username_delegate_->value());
- EXPECT_TRUE(username_delegate_->IsAutofilled());
- EXPECT_EQ(password1_, password_delegate_->value());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
- // And the selection should have been set to 'lice', the last 4 letters.
- EXPECT_EQ(1U, username_delegate_->selection_start());
- EXPECT_EQ(username1_.length(), username_delegate_->selection_end());
- // And both fields should have the autofill style.
- EXPECT_TRUE(username_delegate_->IsAutofilled());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
-
- // Now the user types the next letter of the same username, 'l'.
- listener->performInlineAutocomplete(ASCIIToUTF16("al"), false, false);
- // Now the fields should have the same value, but the selection should have a
- // different start value.
- EXPECT_EQ(username1_, username_delegate_->value());
- EXPECT_TRUE(username_delegate_->IsAutofilled());
- EXPECT_EQ(password1_, password_delegate_->value());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
- EXPECT_EQ(2U, username_delegate_->selection_start());
- EXPECT_EQ(username1_.length(), username_delegate_->selection_end());
-
- // Now lets say the user goes astray from the stored username and types
- // the letter 'f', spelling 'alf'. We don't know alf (that's just sad),
- // so in practice the username should no longer be 'alice' and the selected
- // range should be empty. In our case, when the autocomplete code doesn't
- // know the text, it won't set the value or the selection and hence our
- // delegate methods won't get called. The WebCore::HTMLInputElement's value
- // and selection would be set directly by WebCore in practice.
-
- // Reset the delegate's test state so we can determine what, if anything,
- // was set during performInlineAutocomplete.
- username_delegate_->SetValue(string16());
- username_delegate_->SetSelectionRange(0, 0);
- listener->performInlineAutocomplete(ASCIIToUTF16("alf"), false, false);
- EXPECT_EQ(0U, username_delegate_->selection_start());
- EXPECT_EQ(0U, username_delegate_->selection_end());
- // Username should not have been filled by us.
- EXPECT_TRUE(username_delegate_->value().empty());
- EXPECT_FALSE(username_delegate_->IsAutofilled());
- EXPECT_TRUE(password_delegate_->value().empty());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
-
- // Ok, so now the user removes all the text and enters the letter 'b'.
- listener->performInlineAutocomplete(ASCIIToUTF16("b"), false, false);
- // The username and password fields should match the 'bob' entry.
- EXPECT_EQ(username2_, username_delegate_->value());
- EXPECT_TRUE(username_delegate_->IsAutofilled());
- EXPECT_EQ(password2_, password_delegate_->value());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
- EXPECT_EQ(1U, username_delegate_->selection_start());
- EXPECT_EQ(username2_.length(), username_delegate_->selection_end());
-}
-
-TEST_F(PasswordManagerAutocompleteTests, TestWaitUsername) {
- // If we had an action authority mismatch (for example), we don't want to
- // automatically autofill anything without some user interaction first.
- // We require an explicit blur on the username field, and that a valid
- // matching username is in the field, before we autofill passwords.
- WebKit::WebPasswordAutocompleteListener* listener = CreateListener(true);
-
- // In all cases, username_delegate should remain empty because we should
- // never modify it when wait_for_username is true; only the user can by
- // typing into (in real life) the HTMLInputElement.
- password_delegate_->SetValue(string16());
- listener->performInlineAutocomplete(ASCIIToUTF16("a"), false, false);
- EXPECT_TRUE(username_delegate_->value().empty());
- EXPECT_FALSE(username_delegate_->IsAutofilled());
- EXPECT_TRUE(password_delegate_->value().empty());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
- listener->performInlineAutocomplete(ASCIIToUTF16("al"), false, false);
- EXPECT_TRUE(username_delegate_->value().empty());
- EXPECT_FALSE(username_delegate_->IsAutofilled());
- EXPECT_TRUE(password_delegate_->value().empty());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
- listener->performInlineAutocomplete(ASCIIToUTF16("alice"), false, false);
- EXPECT_TRUE(username_delegate_->value().empty());
- EXPECT_FALSE(username_delegate_->IsAutofilled());
- EXPECT_TRUE(password_delegate_->value().empty());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
-
- listener->didBlurInputElement(ASCIIToUTF16("a"));
- EXPECT_TRUE(username_delegate_->value().empty());
- EXPECT_FALSE(username_delegate_->IsAutofilled());
- EXPECT_TRUE(password_delegate_->value().empty());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
- listener->didBlurInputElement(ASCIIToUTF16("ali"));
- EXPECT_TRUE(username_delegate_->value().empty());
- EXPECT_FALSE(username_delegate_->IsAutofilled());
- EXPECT_TRUE(password_delegate_->value().empty());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
-
- // Blur with 'alice' should allow password autofill.
- listener->didBlurInputElement(ASCIIToUTF16("alice"));
- EXPECT_TRUE(username_delegate_->value().empty());
- EXPECT_FALSE(username_delegate_->IsAutofilled());
- EXPECT_EQ(password1_, password_delegate_->value());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
-}
-
-// Tests that editing the password clears the autofilled password field.
-TEST_F(PasswordManagerAutocompleteTests, TestPasswordClearOnEdit) {
- WebKit::WebPasswordAutocompleteListener* listener = CreateListener(false);
-
- // User enters a known login.
- listener->performInlineAutocomplete(ASCIIToUTF16("alice"), false, false);
- // We are autofilled.
- EXPECT_TRUE(username_delegate_->IsAutofilled());
- EXPECT_EQ(password1_, password_delegate_->value());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
-
- // User modifies the login name to an unknown one.
- listener->performInlineAutocomplete(ASCIIToUTF16("alicia"), false, false);
- // We should not be autofilled anymore and the password should have been
- // cleared.
- EXPECT_FALSE(username_delegate_->IsAutofilled());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
- EXPECT_TRUE(password_delegate_->value().empty());
-}
-
-// Tests that filling with invalid value for input element does not fill.
-TEST_F(PasswordManagerAutocompleteTests, TestValidValueConditions) {
- WebKit::WebPasswordAutocompleteListener* listener = CreateListener(false);
-
- // User enters a known login that validates ok.
- username_delegate_->set_is_valid(true);
- password_delegate_->set_is_valid(true);
- username_delegate_->SetValue(string16());
- password_delegate_->SetValue(string16());
- listener->performInlineAutocomplete(ASCIIToUTF16("alice"), false, false);
- // We are autofilled.
- EXPECT_EQ(username1_, username_delegate_->value());
- EXPECT_TRUE(username_delegate_->IsAutofilled());
- EXPECT_EQ(password1_, password_delegate_->value());
- EXPECT_TRUE(password_delegate_->IsAutofilled());
-
- // User enters a known login that does not validate.
- username_delegate_->set_is_valid(false);
- password_delegate_->set_is_valid(true);
- username_delegate_->SetValue(string16());
- password_delegate_->SetValue(string16());
- listener->performInlineAutocomplete(ASCIIToUTF16("alice"), false, false);
- // We are not autofilled.
- EXPECT_EQ(string16(), username_delegate_->value());
- EXPECT_FALSE(username_delegate_->IsAutofilled());
- EXPECT_EQ(string16(), password_delegate_->value());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
-
- // User enters a known login that validates ok, but password does not.
- username_delegate_->set_is_valid(true);
- password_delegate_->set_is_valid(false);
- username_delegate_->SetValue(string16());
- password_delegate_->SetValue(string16());
- listener->performInlineAutocomplete(ASCIIToUTF16("alice"), false, false);
- // We are autofilled.
- EXPECT_EQ(username1_, username_delegate_->value());
- EXPECT_TRUE(username_delegate_->IsAutofilled());
- EXPECT_EQ(string16(), password_delegate_->value());
- EXPECT_FALSE(password_delegate_->IsAutofilled());
-}
-
-} // namespace
diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi
index 969c9f2..41ed382 100644
--- a/webkit/tools/test_shell/test_shell.gypi
+++ b/webkit/tools/test_shell/test_shell.gypi
@@ -400,7 +400,6 @@
'../../glue/webcursor_unittest.cc',
'../../glue/webframe_unittest.cc',
'../../glue/webkit_glue_unittest.cc',
- '../../glue/webpasswordautocompletelistener_unittest.cc',
'../../glue/webview_unittest.cc',
'../../mocks/mock_resource_loader_bridge.h',
'../../mocks/mock_webframe.cc',