OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/download/download_prefs.h" | 8 #include "chrome/browser/download/download_prefs.h" |
9 #include "chrome/browser/prefs/pref_service_syncable.h" | 9 #include "chrome/browser/prefs/pref_service_syncable.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_commands.h" | 11 #include "chrome/browser/ui/browser_commands.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/testing_browser_process.h" | 16 #include "chrome/test/base/testing_browser_process.h" |
17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
| 19 #include "components/content_settings/core/browser/website_settings_info.h" |
| 20 #include "components/content_settings/core/browser/website_settings_registry.h" |
| 21 #include "components/content_settings/core/common/content_settings_types.h" |
19 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
20 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
21 #include "content/public/test/download_test_observer.h" | 24 #include "content/public/test/download_test_observer.h" |
22 | 25 |
23 using content::BrowserContext; | 26 using content::BrowserContext; |
24 using content::DownloadManager; | 27 using content::DownloadManager; |
25 | 28 |
26 class PrefsFunctionalTest : public InProcessBrowserTest { | 29 class PrefsFunctionalTest : public InProcessBrowserTest { |
27 protected: | 30 protected: |
28 // Create a DownloadTestObserverTerminal that will wait for the | 31 // Create a DownloadTestObserverTerminal that will wait for the |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 " }" | 84 " }" |
82 "}" | 85 "}" |
83 "window.domAutomationController.send(false);"; | 86 "window.domAutomationController.send(false);"; |
84 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 87 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
85 browser()->tab_strip_model()->GetActiveWebContents(), | 88 browser()->tab_strip_model()->GetActiveWebContents(), |
86 script, | 89 script, |
87 &result)); | 90 &result)); |
88 EXPECT_TRUE(result); | 91 EXPECT_TRUE(result); |
89 | 92 |
90 browser()->profile()->GetPrefs()->SetInteger( | 93 browser()->profile()->GetPrefs()->SetInteger( |
91 prefs::kDefaultImagesSetting, CONTENT_SETTING_BLOCK); | 94 content_settings::WebsiteSettingsRegistry::GetInstance() |
| 95 ->Get(CONTENT_SETTINGS_TYPE_IMAGES) |
| 96 ->default_value_pref_name(), |
| 97 CONTENT_SETTING_BLOCK); |
92 | 98 |
93 ui_test_utils::NavigateToURL( | 99 ui_test_utils::NavigateToURL( |
94 browser(), | 100 browser(), |
95 test_server()->GetURL("files/settings/image_page.html")); | 101 test_server()->GetURL("files/settings/image_page.html")); |
96 | 102 |
97 result = false; | 103 result = false; |
98 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 104 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
99 browser()->tab_strip_model()->GetActiveWebContents(), | 105 browser()->tab_strip_model()->GetActiveWebContents(), |
100 script, | 106 script, |
101 &result)); | 107 &result)); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 EXPECT_FALSE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); | 225 EXPECT_FALSE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); |
220 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); | 226 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); |
221 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); | 227 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); |
222 } | 228 } |
223 | 229 |
224 // Verify that we have some Local State prefs. | 230 // Verify that we have some Local State prefs. |
225 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestHaveLocalStatePrefs) { | 231 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestHaveLocalStatePrefs) { |
226 EXPECT_TRUE(g_browser_process->local_state()->GetPreferenceValues().get()); | 232 EXPECT_TRUE(g_browser_process->local_state()->GetPreferenceValues().get()); |
227 } | 233 } |
228 | 234 |
OLD | NEW |