| 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 "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 11 #include "chrome/browser/extensions/extension_service_unittest.h" | 11 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 12 #include "chrome/browser/extensions/tab_helper.h" | 12 #include "chrome/browser/extensions/tab_helper.h" |
| 13 #include "chrome/browser/notifications/desktop_notification_service.h" | 13 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 14 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 14 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 15 #include "chrome/browser/prefs/session_startup_pref.h" | 15 #include "chrome/browser/prefs/session_startup_pref.h" |
| 16 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" | 16 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
| 17 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" | 17 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" |
| 18 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" | 18 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
| 19 #include "chrome/browser/search_engines/template_url_service.h" | 19 #include "chrome/browser/search_engines/template_url_service.h" |
| 20 #include "chrome/browser/search_engines/template_url_service_factory.h" | 20 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 21 #include "chrome/browser/themes/theme_service.h" | 21 #include "chrome/browser/themes/theme_service.h" |
| 22 #include "chrome/browser/themes/theme_service_factory.h" | 22 #include "chrome/browser/themes/theme_service_factory.h" |
| 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 24 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
| 25 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 26 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/test/base/browser_with_test_window_test.h" | 26 #include "chrome/test/base/browser_with_test_window_test.h" |
| 28 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/test/test_browser_thread.h" | 28 #include "content/public/test/test_browser_thread.h" |
| 29 #include "extensions/common/manifest_constants.h" |
| 30 #include "net/http/http_response_headers.h" | 30 #include "net/http/http_response_headers.h" |
| 31 #include "net/url_request/test_url_fetcher_factory.h" | 31 #include "net/url_request/test_url_fetcher_factory.h" |
| 32 | 32 |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 const char kDistributionConfig[] = "{" | 36 const char kDistributionConfig[] = "{" |
| 37 " \"homepage\" : \"http://www.foo.com\"," | 37 " \"homepage\" : \"http://www.foo.com\"," |
| 38 " \"homepage_is_newtabpage\" : false," | 38 " \"homepage_is_newtabpage\" : false," |
| 39 " \"browser\" : {" | 39 " \"browser\" : {" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 | 226 |
| 227 // helper functions ----------------------------------------------------------- | 227 // helper functions ----------------------------------------------------------- |
| 228 | 228 |
| 229 scoped_refptr<Extension> CreateExtension(const std::string& name, | 229 scoped_refptr<Extension> CreateExtension(const std::string& name, |
| 230 const base::FilePath& path, | 230 const base::FilePath& path, |
| 231 Manifest::Location location, | 231 Manifest::Location location, |
| 232 extensions::Manifest::Type type, | 232 extensions::Manifest::Type type, |
| 233 bool installed_by_default) { | 233 bool installed_by_default) { |
| 234 DictionaryValue manifest; | 234 DictionaryValue manifest; |
| 235 manifest.SetString(extension_manifest_keys::kVersion, "1.0.0.0"); | 235 manifest.SetString(extensions::manifest_keys::kVersion, "1.0.0.0"); |
| 236 manifest.SetString(extension_manifest_keys::kName, name); | 236 manifest.SetString(extensions::manifest_keys::kName, name); |
| 237 switch (type) { | 237 switch (type) { |
| 238 case extensions::Manifest::TYPE_THEME: | 238 case extensions::Manifest::TYPE_THEME: |
| 239 manifest.Set(extension_manifest_keys::kTheme, new DictionaryValue); | 239 manifest.Set(extensions::manifest_keys::kTheme, new DictionaryValue); |
| 240 break; | 240 break; |
| 241 case extensions::Manifest::TYPE_HOSTED_APP: | 241 case extensions::Manifest::TYPE_HOSTED_APP: |
| 242 manifest.SetString(extension_manifest_keys::kLaunchWebURL, | 242 manifest.SetString(extensions::manifest_keys::kLaunchWebURL, |
| 243 "http://www.google.com"); | 243 "http://www.google.com"); |
| 244 manifest.SetString(extension_manifest_keys::kUpdateURL, | 244 manifest.SetString(extensions::manifest_keys::kUpdateURL, |
| 245 "http://clients2.google.com/service/update2/crx"); | 245 "http://clients2.google.com/service/update2/crx"); |
| 246 break; | 246 break; |
| 247 case extensions::Manifest::TYPE_EXTENSION: | 247 case extensions::Manifest::TYPE_EXTENSION: |
| 248 // do nothing | 248 // do nothing |
| 249 break; | 249 break; |
| 250 default: | 250 default: |
| 251 NOTREACHED(); | 251 NOTREACHED(); |
| 252 } | 252 } |
| 253 manifest.SetString(extension_manifest_keys::kOmniboxKeyword, name); | 253 manifest.SetString(extensions::manifest_keys::kOmniboxKeyword, name); |
| 254 std::string error; | 254 std::string error; |
| 255 scoped_refptr<Extension> extension = Extension::Create( | 255 scoped_refptr<Extension> extension = Extension::Create( |
| 256 path, | 256 path, |
| 257 location, | 257 location, |
| 258 manifest, | 258 manifest, |
| 259 installed_by_default ? Extension::WAS_INSTALLED_BY_DEFAULT | 259 installed_by_default ? Extension::WAS_INSTALLED_BY_DEFAULT |
| 260 : Extension::NO_FLAGS, | 260 : Extension::NO_FLAGS, |
| 261 &error); | 261 &error); |
| 262 EXPECT_TRUE(extension.get() != NULL) << error; | 262 EXPECT_TRUE(extension.get() != NULL) << error; |
| 263 return extension; | 263 return extension; |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE_IS_NTP), | 796 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE_IS_NTP), |
| 797 dict->GetBoolean("homepage_is_ntp", &homepage_is_ntp)); | 797 dict->GetBoolean("homepage_is_ntp", &homepage_is_ntp)); |
| 798 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::DSE_URL), | 798 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::DSE_URL), |
| 799 dict->GetString("default_search_engine", &default_search_engine)); | 799 dict->GetString("default_search_engine", &default_search_engine)); |
| 800 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::EXTENSIONS), | 800 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::EXTENSIONS), |
| 801 dict->GetList("enabled_extensions", &extensions)); | 801 dict->GetList("enabled_extensions", &extensions)); |
| 802 } | 802 } |
| 803 } | 803 } |
| 804 | 804 |
| 805 } // namespace | 805 } // namespace |
| OLD | NEW |