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

Unified Diff: chrome/browser/webdata/web_data_service_unittest.cc

Issue 8342049: Added Protector, hooked up DSE verification with error bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved histograms to protector folder Created 9 years, 2 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 | « chrome/browser/webdata/web_data_service.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/web_data_service_unittest.cc
diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc
index 4f3ecacdc494e55cdadb8cf7cc788368a17eaca7..123fc71a0e86b63b253cbbce739309f1f99750f5 100644
--- a/chrome/browser/webdata/web_data_service_unittest.cc
+++ b/chrome/browser/webdata/web_data_service_unittest.cc
@@ -146,7 +146,7 @@ class WebDataServiceAutofillTest : public WebDataServiceTest {
// Simple consumer for WebIntents data. Stores the result data and quits UI
// message loop when callback is invoked.
-class WebIntentsConsumer: public WebDataServiceConsumer {
+class WebIntentsConsumer : public WebDataServiceConsumer {
public:
virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
const WDTypedResult* result) {
@@ -173,6 +173,39 @@ class WebIntentsConsumer: public WebDataServiceConsumer {
std::vector<WebIntentServiceData> intents;
};
+// Simple consumer for Keywords data. Stores the result data and quits UI
+// message loop when callback is invoked.
+class KeywordsConsumer : public WebDataServiceConsumer {
+ public:
+ KeywordsConsumer() : load_succeeded(false) {}
+
+ virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
+ const WDTypedResult* result) {
+ if (result) {
+ load_succeeded = true;
+ DCHECK(result->GetType() == KEYWORDS_RESULT);
+ keywords_result =
+ reinterpret_cast<const WDResult<WDKeywordsResult>*>(
+ result)->GetValue();
+ }
+
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ MessageLoop::current()->Quit();
+ }
+
+ // Run the current message loop. OnWebDataServiceRequestDone will invoke
+ // MessageLoop::Quit on completion, so this call will finish at that point.
+ static void WaitUntilCalled() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ MessageLoop::current()->Run();
+ }
+
+ // True if keywords data was loaded successfully.
+ bool load_succeeded;
+ // Result data from completion callback.
+ WDKeywordsResult keywords_result;
+};
+
TEST_F(WebDataServiceAutofillTest, FormFillAdd) {
const AutofillChange expected_changes[] = {
AutofillChange(AutofillChange::ADD, AutofillKey(name1_, value1_)),
@@ -662,3 +695,12 @@ TEST_F(WebDataServiceTest, WebIntentsGetAll) {
service.action = ASCIIToUTF16("share");
EXPECT_EQ(service, consumer.intents[1]);
}
+
+TEST_F(WebDataServiceTest, DidDefaultSearchProviderChangeOnNewProfile) {
+ KeywordsConsumer consumer;
+ wds_->GetKeywords(&consumer);
+ KeywordsConsumer::WaitUntilCalled();
+ ASSERT_TRUE(consumer.load_succeeded);
+ EXPECT_FALSE(consumer.keywords_result.did_default_search_provider_change);
+ EXPECT_EQ(0, consumer.keywords_result.default_search_provider_id_backup);
+}
« no previous file with comments | « chrome/browser/webdata/web_data_service.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698