| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/profile_resetter/profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
| 6 | 6 |
| 7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/test/scoped_path_override.h" | 11 #include "base/test/scoped_path_override.h" |
| 12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/extension_service_test_base.h" | 14 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 14 #include "chrome/browser/extensions/tab_helper.h" | 15 #include "chrome/browser/extensions/tab_helper.h" |
| 15 #include "chrome/browser/prefs/session_startup_pref.h" | 16 #include "chrome/browser/prefs/session_startup_pref.h" |
| 16 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" | 17 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
| 17 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" | 18 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" |
| 18 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" | 19 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
| 19 #include "chrome/browser/search_engines/template_url_service_factory.h" | 20 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 20 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 21 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 21 #include "chrome/browser/themes/theme_service.h" | 22 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 477 |
| 477 ResetAndWait(ProfileResetter::HOMEPAGE); | 478 ResetAndWait(ProfileResetter::HOMEPAGE); |
| 478 | 479 |
| 479 EXPECT_TRUE(prefs->GetBoolean(prefs::kHomePageIsNewTabPage)); | 480 EXPECT_TRUE(prefs->GetBoolean(prefs::kHomePageIsNewTabPage)); |
| 480 EXPECT_EQ("http://www.foo.com", prefs->GetString(prefs::kHomePage)); | 481 EXPECT_EQ("http://www.foo.com", prefs->GetString(prefs::kHomePage)); |
| 481 EXPECT_FALSE(prefs->GetBoolean(prefs::kShowHomeButton)); | 482 EXPECT_FALSE(prefs->GetBoolean(prefs::kShowHomeButton)); |
| 482 } | 483 } |
| 483 | 484 |
| 484 TEST_F(ProfileResetterTest, ResetContentSettings) { | 485 TEST_F(ProfileResetterTest, ResetContentSettings) { |
| 485 HostContentSettingsMap* host_content_settings_map = | 486 HostContentSettingsMap* host_content_settings_map = |
| 486 profile()->GetHostContentSettingsMap(); | 487 HostContentSettingsMapFactory::GetForProfile(profile()); |
| 487 ContentSettingsPattern pattern = | 488 ContentSettingsPattern pattern = |
| 488 ContentSettingsPattern::FromString("[*.]example.org"); | 489 ContentSettingsPattern::FromString("[*.]example.org"); |
| 489 std::map<ContentSettingsType, ContentSetting> default_settings; | 490 std::map<ContentSettingsType, ContentSetting> default_settings; |
| 490 | 491 |
| 491 // TODO(raymes): Clean up this test so that we don't have such ugly iteration | 492 // TODO(raymes): Clean up this test so that we don't have such ugly iteration |
| 492 // over the content settings. | 493 // over the content settings. |
| 493 content_settings::WebsiteSettingsRegistry* registry = | 494 content_settings::WebsiteSettingsRegistry* registry = |
| 494 content_settings::WebsiteSettingsRegistry::GetInstance(); | 495 content_settings::WebsiteSettingsRegistry::GetInstance(); |
| 495 for (const content_settings::WebsiteSettingsInfo* info : *registry) { | 496 for (const content_settings::WebsiteSettingsInfo* info : *registry) { |
| 496 ContentSettingsType content_type = info->type(); | 497 ContentSettingsType content_type = info->type(); |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 new ResettableSettingsSnapshot(profile())); | 1080 new ResettableSettingsSnapshot(profile())); |
| 1080 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, | 1081 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, |
| 1081 base::Unretained(&capture))); | 1082 base::Unretained(&capture))); |
| 1082 deleted_snapshot.reset(); | 1083 deleted_snapshot.reset(); |
| 1083 // Running remaining tasks shouldn't trigger the callback to be called as | 1084 // Running remaining tasks shouldn't trigger the callback to be called as |
| 1084 // |deleted_snapshot| was deleted before it could run. | 1085 // |deleted_snapshot| was deleted before it could run. |
| 1085 base::MessageLoop::current()->RunUntilIdle(); | 1086 base::MessageLoop::current()->RunUntilIdle(); |
| 1086 } | 1087 } |
| 1087 | 1088 |
| 1088 } // namespace | 1089 } // namespace |
| OLD | NEW |