| 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 a72e2fa510f4cc0934a1ab77f65adf840a77d868..d1cf653b7b5105f355d802499f650d54a5fe1f45 100644
|
| --- a/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
|
| +++ b/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
|
| @@ -24,7 +24,6 @@
|
| #include "chrome/browser/google/google_util.h"
|
| #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
|
| #include "chrome/browser/profile_resetter/profile_reset_global_error.h"
|
| -#include "chrome/browser/search_engines/default_search_manager.h"
|
| #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
|
| #include "chrome/browser/search_engines/template_url_service.h"
|
| #include "chrome/browser/search_engines/template_url_service_factory.h"
|
| @@ -92,10 +91,16 @@
|
|
|
| // Returns the details of the default search provider from |prefs| in a format
|
| // suitable for usage as |expected_details| in ExpectDetailsMatch().
|
| -const base::DictionaryValue* GetDefaultSearchProviderDetailsFromPrefs(
|
| +scoped_ptr<base::DictionaryValue> GetDefaultSearchProviderDetailsFromPrefs(
|
| const PrefService* prefs) {
|
| - return prefs->GetDictionary(
|
| - DefaultSearchManager::kDefaultSearchProviderDataPrefName);
|
| + 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);
|
| }
|
|
|
| // Verifies that the |details| of a search engine as provided by the delegate
|
| @@ -114,9 +119,24 @@
|
| const base::Value* actual_value = NULL;
|
| ASSERT_TRUE(details.Get(it.key(), &actual_value));
|
|
|
| - // Ignore ID as it is dynamically assigned by the TemplateURLService.
|
| - // last_modified may get updated during a run, so ignore value differences.
|
| - if (it.key() != "id" && it.key() != "last_modified") {
|
| + if (it.key() == "id") {
|
| + // 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, ';'));
|
| + } else {
|
| // Everything else is the same format.
|
| EXPECT_TRUE(actual_value->Equals(expected_value))
|
| << "Expected: " << *expected_value << ". Actual: " << *actual_value;
|
| @@ -359,8 +379,8 @@
|
| ASSERT_TRUE(prefs);
|
| scoped_ptr<base::DictionaryValue> dsp_details(
|
| resetter_delegate()->GetDefaultSearchProviderDetails());
|
| - const base::DictionaryValue* expected_dsp_details =
|
| - GetDefaultSearchProviderDetailsFromPrefs(prefs);
|
| + scoped_ptr<base::DictionaryValue> expected_dsp_details(
|
| + GetDefaultSearchProviderDetailsFromPrefs(prefs));
|
|
|
| ExpectDetailsMatch(*expected_dsp_details, *dsp_details);
|
| EXPECT_FALSE(resetter_delegate()->IsDefaultSearchProviderManaged());
|
| @@ -433,8 +453,8 @@
|
|
|
| PrefService* prefs = profile()->GetPrefs();
|
| ASSERT_TRUE(prefs);
|
| - const base::DictionaryValue* expected_dsp_details =
|
| - GetDefaultSearchProviderDetailsFromPrefs(prefs);
|
| + scoped_ptr<base::DictionaryValue> expected_dsp_details(
|
| + GetDefaultSearchProviderDetailsFromPrefs(prefs));
|
| ExpectDetailsMatch(*expected_dsp_details, *details);
|
| }
|
| }
|
|
|