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

Side by Side Diff: chrome/browser/profile_resetter/profile_resetter_unittest.cc

Issue 440423003: Clean content_settings_pattern_parser.* from unnecessary dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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_factory.h" 19 #include "chrome/browser/search_engines/template_url_service_factory.h"
20 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" 20 #include "chrome/browser/search_engines/ui_thread_search_terms_data.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/browser/webdata/web_data_service_factory.h" 24 #include "chrome/browser/webdata/web_data_service_factory.h"
25 #include "chrome/common/chrome_content_settings_client.h"
25 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
26 #include "chrome/test/base/browser_with_test_window_test.h" 27 #include "chrome/test/base/browser_with_test_window_test.h"
27 #include "components/google/core/browser/google_pref_names.h" 28 #include "components/google/core/browser/google_pref_names.h"
28 #include "components/search_engines/template_url_service.h" 29 #include "components/search_engines/template_url_service.h"
29 #include "components/search_engines/template_url_service_client.h" 30 #include "components/search_engines/template_url_service_client.h"
30 #include "content/public/browser/web_contents.h" 31 #include "content/public/browser/web_contents.h"
31 #include "content/public/test/test_browser_thread.h" 32 #include "content/public/test/test_browser_thread.h"
32 #include "extensions/common/extension.h" 33 #include "extensions/common/extension.h"
33 #include "extensions/common/manifest_constants.h" 34 #include "extensions/common/manifest_constants.h"
34 #include "net/http/http_response_headers.h" 35 #include "net/http/http_response_headers.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 ResetAndWait(ProfileResetter::HOMEPAGE); 486 ResetAndWait(ProfileResetter::HOMEPAGE);
486 487
487 EXPECT_TRUE(prefs->GetBoolean(prefs::kHomePageIsNewTabPage)); 488 EXPECT_TRUE(prefs->GetBoolean(prefs::kHomePageIsNewTabPage));
488 EXPECT_EQ("http://www.foo.com", prefs->GetString(prefs::kHomePage)); 489 EXPECT_EQ("http://www.foo.com", prefs->GetString(prefs::kHomePage));
489 EXPECT_FALSE(prefs->GetBoolean(prefs::kShowHomeButton)); 490 EXPECT_FALSE(prefs->GetBoolean(prefs::kShowHomeButton));
490 } 491 }
491 492
492 TEST_F(ProfileResetterTest, ResetContentSettings) { 493 TEST_F(ProfileResetterTest, ResetContentSettings) {
493 HostContentSettingsMap* host_content_settings_map = 494 HostContentSettingsMap* host_content_settings_map =
494 profile()->GetHostContentSettingsMap(); 495 profile()->GetHostContentSettingsMap();
496 content_settings::ChromeContentSettingsClient client;
495 ContentSettingsPattern pattern = 497 ContentSettingsPattern pattern =
496 ContentSettingsPattern::FromString("[*.]example.org"); 498 ContentSettingsPattern::FromString(&client, "[*.]example.org");
497 std::map<ContentSettingsType, ContentSetting> default_settings; 499 std::map<ContentSettingsType, ContentSetting> default_settings;
498 500
499 for (int type = 0; type < CONTENT_SETTINGS_NUM_TYPES; ++type) { 501 for (int type = 0; type < CONTENT_SETTINGS_NUM_TYPES; ++type) {
500 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE || 502 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE ||
501 type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT || 503 type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT ||
502 type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) { 504 type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) {
503 // These types are excluded because one can't call 505 // These types are excluded because one can't call
504 // GetDefaultContentSetting() for them. 506 // GetDefaultContentSetting() for them.
505 } else { 507 } else {
506 ContentSettingsType content_type = static_cast<ContentSettingsType>(type); 508 ContentSettingsType content_type = static_cast<ContentSettingsType>(type);
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 new ResettableSettingsSnapshot(profile())); 1093 new ResettableSettingsSnapshot(profile()));
1092 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, 1094 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail,
1093 base::Unretained(&capture))); 1095 base::Unretained(&capture)));
1094 deleted_snapshot.reset(); 1096 deleted_snapshot.reset();
1095 // Running remaining tasks shouldn't trigger the callback to be called as 1097 // Running remaining tasks shouldn't trigger the callback to be called as
1096 // |deleted_snapshot| was deleted before it could run. 1098 // |deleted_snapshot| was deleted before it could run.
1097 base::MessageLoop::current()->RunUntilIdle(); 1099 base::MessageLoop::current()->RunUntilIdle();
1098 } 1100 }
1099 1101
1100 } // namespace 1102 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698