diff options
author | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-27 17:01:06 +0000 |
---|---|---|
committer | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-27 17:01:06 +0000 |
commit | f7359809aea977080efbbdcc91b6136d4a0c9de6 (patch) | |
tree | 442b99a21016ab4b82cec103184f76545f53e99c /chrome/browser/autofill/autofill_external_delegate_unittest.cc | |
parent | 10a202e93925c25bb8c8a216d1402f28446cdc0c (diff) | |
download | chromium_src-f7359809aea977080efbbdcc91b6136d4a0c9de6.zip chromium_src-f7359809aea977080efbbdcc91b6136d4a0c9de6.tar.gz chromium_src-f7359809aea977080efbbdcc91b6136d4a0c9de6.tar.bz2 |
New Autofill UI properly changes Colour.
Fixes a bug where the new Autofill UI would change the colour of an input element to yellow when showing a preview in it and fail to change the colour back once the preview was cleared.
BUG=51644
TEST=When using the new Autofill UI, elements returns to their original colour when the preview ends.
Review URL: http://codereview.chromium.org/10020055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134286 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/autofill_external_delegate_unittest.cc')
-rw-r--r-- | chrome/browser/autofill/autofill_external_delegate_unittest.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/autofill/autofill_external_delegate_unittest.cc b/chrome/browser/autofill/autofill_external_delegate_unittest.cc index 1f1c918..dabdaf8 100644 --- a/chrome/browser/autofill/autofill_external_delegate_unittest.cc +++ b/chrome/browser/autofill/autofill_external_delegate_unittest.cc @@ -14,6 +14,7 @@ #include "content/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" #include "ui/gfx/rect.h" #include "webkit/forms/form_data.h" #include "webkit/forms/form_field.h" @@ -22,6 +23,7 @@ using content::BrowserThread; using testing::_; using webkit::forms::FormData; using webkit::forms::FormField; +using WebKit::WebAutofillClient; namespace { @@ -45,6 +47,8 @@ class MockAutofillExternalDelegate : public TestAutofillExternalDelegate { const webkit::forms::FormField& field, const gfx::Rect& bounds)); + MOCK_METHOD0(ClearPreviewedForm, void()); + MOCK_METHOD0(HideAutofillPopup, void()); private: @@ -123,6 +127,9 @@ TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) { EXPECT_CALL(*external_delegate_, HideAutofillPopup()); + // Called by DidAutofillSuggestions, add expectation to remove warning. + EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)); + // This should trigger a call to hide the popup since // we've selected an option. external_delegate_->DidAcceptAutofillSuggestions(autofill_item[0], @@ -140,3 +147,21 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateInvalidUniqueId) { EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)).Times(0); external_delegate_->DidAcceptAutofillSuggestions(string16(), -1, 0); } + +// Test that the ClearPreview IPC is only sent the form was being previewed +// (i.e. it isn't autofilling a password). +TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateClearPreviewedForm) { + // Called by SelectAutofillSuggestionAtIndex, add expectation to remove + // warning. + EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)); + + // Ensure selecting a new password entries or Autofill entries will + // cause any previews to get cleared. + EXPECT_CALL(*external_delegate_, ClearPreviewedForm()).Times(1); + external_delegate_->SelectAutofillSuggestionAtIndex( + WebAutofillClient::MenuItemIDPasswordEntry, + 0); + + EXPECT_CALL(*external_delegate_, ClearPreviewedForm()).Times(1); + external_delegate_->SelectAutofillSuggestionAtIndex(1, 0); +} |