summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete_history_manager_unittest.cc
diff options
context:
space:
mode:
authorthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-08 13:43:51 +0000
committerthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-08 13:43:51 +0000
commita39aa53a7acabb03a86a5be5c663d6ae47215440 (patch)
treee304aa2f39c6103bf75d151c41730f43d9111b1a /chrome/browser/autocomplete_history_manager_unittest.cc
parenta5e04eafb781ce5739ab08398bc7ded7ed512116 (diff)
downloadchromium_src-a39aa53a7acabb03a86a5be5c663d6ae47215440.zip
chromium_src-a39aa53a7acabb03a86a5be5c663d6ae47215440.tar.gz
chromium_src-a39aa53a7acabb03a86a5be5c663d6ae47215440.tar.bz2
Backing this out to see if it fixes the failures on the two windows bots (landed about when they started).
Revert 49030 - AutoFill: Don't save credit card numbers from Autocomplete to the WebDB. BUG=8026 TEST=AutocompleteHistoryManagerTest Review URL: http://codereview.chromium.org/2676003 TBR=jhawkins@chromium.org Review URL: http://codereview.chromium.org/2748002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49164 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete_history_manager_unittest.cc')
-rw-r--r--chrome/browser/autocomplete_history_manager_unittest.cc86
1 files changed, 0 insertions, 86 deletions
diff --git a/chrome/browser/autocomplete_history_manager_unittest.cc b/chrome/browser/autocomplete_history_manager_unittest.cc
deleted file mode 100644
index 49a473c..0000000
--- a/chrome/browser/autocomplete_history_manager_unittest.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2010 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 <vector>
-
-#include "base/ref_counted.h"
-#include "base/string16.h"
-#include "base/task.h"
-#include "chrome/browser/autocomplete_history_manager.h"
-#include "chrome/browser/webdata/web_data_service.h"
-#include "chrome/test/testing_profile.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/glue/form_data.h"
-
-using testing::_;
-using webkit_glue::FormData;
-
-class MockWebDataService : public WebDataService {
- public:
- MOCK_METHOD1(AddFormFields,
- void(const std::vector<webkit_glue::FormField>&)); // NOLINT
-};
-
-class AutocompleteHistoryManagerTest : public testing::Test {
- protected:
- AutocompleteHistoryManagerTest()
- : ui_thread_(ChromeThread::UI, &message_loop_) {
- }
-
- virtual void SetUp() {
- web_data_service_ = new MockWebDataService();
- autocomplete_manager_.reset(
- new AutocompleteHistoryManager(&profile_, web_data_service_));
- }
-
- MessageLoopForUI message_loop_;
- ChromeThread ui_thread_;
-
- TestingProfile profile_;
- scoped_refptr<MockWebDataService> web_data_service_;
- scoped_ptr<AutocompleteHistoryManager> autocomplete_manager_;
-};
-
-// Tests that credit card numbers are not sent to the WebDatabase to be saved.
-TEST_F(AutocompleteHistoryManagerTest, CreditCardNumberValue) {
- FormData form;
- form.name = ASCIIToUTF16("MyForm");
- form.method = ASCIIToUTF16("POST");
- form.origin = GURL("http://myform.com/form.html");
- form.action = GURL("http://myform.com/submit.html");
-
- // Valid Visa credit card number pulled from the paypal help site.
- webkit_glue::FormField valid_cc(ASCIIToUTF16("Credit Card"),
- ASCIIToUTF16("ccnum"),
- ASCIIToUTF16("4012888888881881"),
- ASCIIToUTF16("text"),
- 20);
- form.fields.push_back(valid_cc);
-
- EXPECT_CALL(*web_data_service_, AddFormFields(_)).Times(0);
- autocomplete_manager_->FormSubmitted(form);
-}
-
-// Contrary test to AutocompleteHistoryManagerTest.CreditCardNumberValue. The
-// value being submitted is not a valid credit card number, so it will be sent
-// to the WebDatabase to be saved.
-TEST_F(AutocompleteHistoryManagerTest, NonCreditCardNumberValue) {
- FormData form;
- form.name = ASCIIToUTF16("MyForm");
- form.method = ASCIIToUTF16("POST");
- form.origin = GURL("http://myform.com/form.html");
- form.action = GURL("http://myform.com/submit.html");
-
- // Invalid credit card number.
- webkit_glue::FormField invalid_cc(ASCIIToUTF16("Credit Card"),
- ASCIIToUTF16("ccnum"),
- ASCIIToUTF16("4580123456789012"),
- ASCIIToUTF16("text"),
- 20);
- form.fields.push_back(invalid_cc);
-
- EXPECT_CALL(*(web_data_service_.get()), AddFormFields(_)).Times(1);
- autocomplete_manager_->FormSubmitted(form);
-}