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

Unified Diff: chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc

Issue 268643002: Use the DefaultSearchManager as the exclusive authority on DSE, ignoring Web Data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Last test fix? Created 6 years, 7 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
Index: chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
diff --git a/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc b/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
index d1cf653b7b5105f355d802499f650d54a5fe1f45..c67442627ed4329d225b408796dd9a7ebf8c01e3 100644
--- a/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
+++ b/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
@@ -91,16 +91,9 @@ class MockCallbackTarget {
// Returns the details of the default search provider from |prefs| in a format
// suitable for usage as |expected_details| in ExpectDetailsMatch().
-scoped_ptr<base::DictionaryValue> GetDefaultSearchProviderDetailsFromPrefs(
+const base::DictionaryValue* GetDefaultSearchProviderDetailsFromPrefs(
const PrefService* prefs) {
- const char kDefaultSearchProviderPrefix[] = "default_search_provider";
- scoped_ptr<base::DictionaryValue> pref_values_with_path_expansion(
- prefs->GetPreferenceValues());
- const base::DictionaryValue* dsp_details = NULL;
- EXPECT_TRUE(pref_values_with_path_expansion->GetDictionary(
- kDefaultSearchProviderPrefix, &dsp_details));
- return scoped_ptr<base::DictionaryValue>(
- dsp_details ? dsp_details->DeepCopy() : new base::DictionaryValue);
+ return prefs->GetDictionary("default_search_provider_data.template_url_data");
}
// Verifies that the |details| of a search engine as provided by the delegate
@@ -119,23 +112,10 @@ void ExpectDetailsMatch(const base::DictionaryValue& expected_details,
const base::Value* actual_value = NULL;
ASSERT_TRUE(details.Get(it.key(), &actual_value));
- if (it.key() == "id") {
+ if (it.key() == "id" || it.key() == "last_modified") {
// Ignore ID as it is dynamically assigned by the TemplateURLService.
- } else if (it.key() == "encodings") {
- // Encoding list is stored in Prefs as a single string with tokens
- // delimited by semicolons.
- std::string expected_encodings;
- ASSERT_TRUE(expected_value->GetAsString(&expected_encodings));
- const base::ListValue* actual_encodings_list = NULL;
- ASSERT_TRUE(actual_value->GetAsList(&actual_encodings_list));
- std::vector<std::string> actual_encodings_vector;
- for (base::ListValue::const_iterator it = actual_encodings_list->begin();
- it != actual_encodings_list->end(); ++it) {
- std::string encoding;
- ASSERT_TRUE((*it)->GetAsString(&encoding));
- actual_encodings_vector.push_back(encoding);
- }
- EXPECT_EQ(expected_encodings, JoinString(actual_encodings_vector, ';'));
+ // last_modified may get updated during a run, so ignore value
+ // differences.
} else {
// Everything else is the same format.
EXPECT_TRUE(actual_value->Equals(expected_value))
@@ -379,8 +359,8 @@ TEST_F(AutomaticProfileResetterDelegateTest,
ASSERT_TRUE(prefs);
scoped_ptr<base::DictionaryValue> dsp_details(
resetter_delegate()->GetDefaultSearchProviderDetails());
- scoped_ptr<base::DictionaryValue> expected_dsp_details(
- GetDefaultSearchProviderDetailsFromPrefs(prefs));
+ const base::DictionaryValue* expected_dsp_details =
+ GetDefaultSearchProviderDetailsFromPrefs(prefs);
ExpectDetailsMatch(*expected_dsp_details, *dsp_details);
EXPECT_FALSE(resetter_delegate()->IsDefaultSearchProviderManaged());
@@ -453,8 +433,8 @@ TEST_F(AutomaticProfileResetterDelegateTest,
PrefService* prefs = profile()->GetPrefs();
ASSERT_TRUE(prefs);
- scoped_ptr<base::DictionaryValue> expected_dsp_details(
- GetDefaultSearchProviderDetailsFromPrefs(prefs));
+ const base::DictionaryValue* expected_dsp_details =
+ GetDefaultSearchProviderDetailsFromPrefs(prefs);
ExpectDetailsMatch(*expected_dsp_details, *details);
}
}

Powered by Google App Engine
This is Rietveld 408576698