| 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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/test/scoped_path_override.h" | 10 #include "base/test/scoped_path_override.h" |
| 11 #include "chrome/browser/content_settings/host_content_settings_map.h" | 11 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/extension_service_test_base.h" | 13 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 14 #include "chrome/browser/extensions/tab_helper.h" | 14 #include "chrome/browser/extensions/tab_helper.h" |
| 15 #include "chrome/browser/notifications/desktop_notification_service.h" | 15 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 16 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 16 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 17 #include "chrome/browser/prefs/session_startup_pref.h" | 17 #include "chrome/browser/prefs/session_startup_pref.h" |
| 18 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" | 18 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
| 19 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" | 19 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" |
| 20 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" | 20 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
| 21 #include "chrome/browser/search_engines/template_url_service.h" | 21 #include "chrome/browser/search_engines/template_url_service.h" |
| 22 #include "chrome/browser/search_engines/template_url_service_client.h" |
| 22 #include "chrome/browser/search_engines/template_url_service_factory.h" | 23 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 24 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 23 #include "chrome/browser/themes/theme_service.h" | 25 #include "chrome/browser/themes/theme_service.h" |
| 24 #include "chrome/browser/themes/theme_service_factory.h" | 26 #include "chrome/browser/themes/theme_service_factory.h" |
| 25 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 28 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 26 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/test/base/browser_with_test_window_test.h" | 30 #include "chrome/test/base/browser_with_test_window_test.h" |
| 28 #include "components/google/core/browser/google_pref_names.h" | 31 #include "components/google/core/browser/google_pref_names.h" |
| 29 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| 30 #include "content/public/test/test_browser_thread.h" | 33 #include "content/public/test/test_browser_thread.h" |
| 31 #include "extensions/common/extension.h" | 34 #include "extensions/common/extension.h" |
| 32 #include "extensions/common/manifest_constants.h" | 35 #include "extensions/common/manifest_constants.h" |
| 33 #include "net/http/http_response_headers.h" | 36 #include "net/http/http_response_headers.h" |
| 34 #include "net/http/http_status_code.h" | 37 #include "net/http/http_status_code.h" |
| 35 #include "net/url_request/test_url_fetcher_factory.h" | 38 #include "net/url_request/test_url_fetcher_factory.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 profile()->CreateWebDataService(); | 141 profile()->CreateWebDataService(); |
| 139 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( | 142 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
| 140 profile(), | 143 profile(), |
| 141 &ProfileResetterTest::CreateTemplateURLService); | 144 &ProfileResetterTest::CreateTemplateURLService); |
| 142 resetter_.reset(new ProfileResetter(profile())); | 145 resetter_.reset(new ProfileResetter(profile())); |
| 143 } | 146 } |
| 144 | 147 |
| 145 // static | 148 // static |
| 146 KeyedService* ProfileResetterTest::CreateTemplateURLService( | 149 KeyedService* ProfileResetterTest::CreateTemplateURLService( |
| 147 content::BrowserContext* context) { | 150 content::BrowserContext* context) { |
| 148 return new TemplateURLService(static_cast<Profile*>(context), NULL, | 151 Profile* profile = static_cast<Profile*>(context); |
| 149 base::Closure()); | 152 return new TemplateURLService( |
| 153 profile->GetPrefs(), |
| 154 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), |
| 155 WebDataServiceFactory::GetKeywordWebDataForProfile( |
| 156 profile, Profile::EXPLICIT_ACCESS), |
| 157 scoped_ptr<TemplateURLServiceClient>(), NULL, NULL, base::Closure()); |
| 150 } | 158 } |
| 151 | 159 |
| 152 | 160 |
| 153 // PinnedTabsResetTest -------------------------------------------------------- | 161 // PinnedTabsResetTest -------------------------------------------------------- |
| 154 | 162 |
| 155 class PinnedTabsResetTest : public BrowserWithTestWindowTest, | 163 class PinnedTabsResetTest : public BrowserWithTestWindowTest, |
| 156 public ProfileResetterTestBase { | 164 public ProfileResetterTestBase { |
| 157 protected: | 165 protected: |
| 158 virtual void SetUp() OVERRIDE; | 166 virtual void SetUp() OVERRIDE; |
| 159 | 167 |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 new ResettableSettingsSnapshot(profile())); | 1105 new ResettableSettingsSnapshot(profile())); |
| 1098 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, | 1106 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, |
| 1099 base::Unretained(&capture))); | 1107 base::Unretained(&capture))); |
| 1100 deleted_snapshot.reset(); | 1108 deleted_snapshot.reset(); |
| 1101 // Running remaining tasks shouldn't trigger the callback to be called as | 1109 // Running remaining tasks shouldn't trigger the callback to be called as |
| 1102 // |deleted_snapshot| was deleted before it could run. | 1110 // |deleted_snapshot| was deleted before it could run. |
| 1103 base::MessageLoop::current()->RunUntilIdle(); | 1111 base::MessageLoop::current()->RunUntilIdle(); |
| 1104 } | 1112 } |
| 1105 | 1113 |
| 1106 } // namespace | 1114 } // namespace |
| OLD | NEW |