diff options
author | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 04:13:24 +0000 |
---|---|---|
committer | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 04:13:24 +0000 |
commit | 55f9c5a5466d0c7d5550252b653162d7dc775442 (patch) | |
tree | 0bf06f2e83478a50222b23c2bdf39cb9e83ecf63 /chrome/browser/webdata | |
parent | 52aac9e4ff1d4181f1b980a29446fdf5036a185a (diff) | |
download | chromium_src-55f9c5a5466d0c7d5550252b653162d7dc775442.zip chromium_src-55f9c5a5466d0c7d5550252b653162d7dc775442.tar.gz chromium_src-55f9c5a5466d0c7d5550252b653162d7dc775442.tar.bz2 |
Add integration test for autofill profiles.
I also expanded on the orignial autofill "steady" test to include removals. Plus a little refactoring of the WDS test.
Review URL: http://codereview.chromium.org/1963001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46438 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata')
-rw-r--r-- | chrome/browser/webdata/autofill_entry.h | 1 | ||||
-rw-r--r-- | chrome/browser/webdata/web_data_service_test_util.h | 14 | ||||
-rw-r--r-- | chrome/browser/webdata/web_data_service_unittest.cc | 9 |
3 files changed, 11 insertions, 13 deletions
diff --git a/chrome/browser/webdata/autofill_entry.h b/chrome/browser/webdata/autofill_entry.h index 8781fbd..cb310c3 100644 --- a/chrome/browser/webdata/autofill_entry.h +++ b/chrome/browser/webdata/autofill_entry.h @@ -7,7 +7,6 @@ #include <vector> #include "base/string16.h" -#include "base/string_util.h" #include "base/time.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/webdata/web_data_service_test_util.h b/chrome/browser/webdata/web_data_service_test_util.h index 31abfac..dba6fc3 100644 --- a/chrome/browser/webdata/web_data_service_test_util.h +++ b/chrome/browser/webdata/web_data_service_test_util.h @@ -12,6 +12,7 @@ #include "chrome/browser/chrome_thread.h" #include "chrome/browser/webdata/web_data_service.h" +template <class T> class AutofillWebDataServiceConsumer: public WebDataServiceConsumer { public: AutofillWebDataServiceConsumer() : handle_(0) {} @@ -20,23 +21,20 @@ class AutofillWebDataServiceConsumer: public WebDataServiceConsumer { virtual void OnWebDataServiceRequestDone(WebDataService::Handle handle, const WDTypedResult* result) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); - DCHECK(result->GetType() == AUTOFILL_VALUE_RESULT); handle_ = handle; - const WDResult<std::vector<string16> >* autofill_result = - static_cast<const WDResult<std::vector<string16> >*>(result); - // Copy the values. - values_ = autofill_result->GetValue(); + const WDResult<T>* wrapped_result = + static_cast<const WDResult<T>*>(result); + result_ = wrapped_result->GetValue(); - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); MessageLoop::current()->Quit(); } WebDataService::Handle handle() { return handle_; } - const std::vector<string16>& values() { return values_; } + T& result() { return result_; } private: WebDataService::Handle handle_; - std::vector<string16> values_; + T result_; DISALLOW_COPY_AND_ASSIGN(AutofillWebDataServiceConsumer); }; diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc index 043a091..c11d4b7 100644 --- a/chrome/browser/webdata/web_data_service_unittest.cc +++ b/chrome/browser/webdata/web_data_service_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> #include <vector> #include "base/basictypes.h" @@ -169,7 +170,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillAdd) { // The event will be signaled when the mock observer is notified. done_event_.TimedWait(test_timeout_); - AutofillWebDataServiceConsumer consumer; + AutofillWebDataServiceConsumer<std::vector<string16> > consumer; WebDataService::Handle handle; static const int limit = 10; handle = wds_->GetFormValuesForElementName( @@ -179,8 +180,8 @@ TEST_F(WebDataServiceAutofillTest, FormFillAdd) { MessageLoop::current()->Run(); EXPECT_EQ(handle, consumer.handle()); - ASSERT_EQ(1U, consumer.values().size()); - EXPECT_EQ(value1_, consumer.values()[0]); + ASSERT_EQ(1U, consumer.result().size()); + EXPECT_EQ(value1_, consumer.result()[0]); } TEST_F(WebDataServiceAutofillTest, FormFillRemoveOne) { @@ -212,7 +213,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillRemoveOne) { done_event_.TimedWait(test_timeout_); } -TEST_F(WebDataServiceAutofillTest,FormFillRemoveMany) { +TEST_F(WebDataServiceAutofillTest, FormFillRemoveMany) { TimeDelta one_day(TimeDelta::FromDays(1)); Time t = Time::Now(); |