Chromium Code Reviews| 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/net/prediction_options.h" | |
| 9 #include "chrome/browser/prefs/pref_service_syncable.h" | 10 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_commands.h" | 12 #include "chrome/browser/ui/browser_commands.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
| 16 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 18 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 | 198 |
| 198 PrefService* prefs = browser()->profile()->GetPrefs(); | 199 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 199 EXPECT_FALSE(prefs->GetBoolean(prefs::kHomePageIsNewTabPage)); | 200 EXPECT_FALSE(prefs->GetBoolean(prefs::kHomePageIsNewTabPage)); |
| 200 EXPECT_EQ(home_page_url.spec(), prefs->GetString(prefs::kHomePage)); | 201 EXPECT_EQ(home_page_url.spec(), prefs->GetString(prefs::kHomePage)); |
| 201 } | 202 } |
| 202 | 203 |
| 203 // Verify the security preference under privacy across restarts. Part1 | 204 // Verify the security preference under privacy across restarts. Part1 |
| 204 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, PRE_TestPrivacySecurityPrefs) { | 205 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, PRE_TestPrivacySecurityPrefs) { |
| 205 PrefService* prefs = browser()->profile()->GetPrefs(); | 206 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 206 | 207 |
| 207 EXPECT_TRUE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); | 208 EXPECT_NE(chrome_browser_net::NETWORK_PREDICTION_DEFAULT, |
|
Bernhard Bauer
2015/09/14 18:52:41
If this fails, something is _seriously_ wrong 😉 AS
Bence
2015/09/14 21:56:57
Done.
| |
| 208 prefs->SetBoolean(prefs::kNetworkPredictionEnabled, false); | 209 chrome_browser_net::NETWORK_PREDICTION_NEVER); |
| 210 EXPECT_EQ(chrome_browser_net::NETWORK_PREDICTION_DEFAULT, | |
| 211 prefs->GetInteger(prefs::kNetworkPredictionOptions)); | |
| 212 prefs->SetInteger(prefs::kNetworkPredictionOptions, | |
| 213 chrome_browser_net::NETWORK_PREDICTION_NEVER); | |
| 209 | 214 |
| 210 EXPECT_TRUE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); | 215 EXPECT_TRUE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); |
| 211 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, false); | 216 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, false); |
| 212 | 217 |
| 213 EXPECT_TRUE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); | 218 EXPECT_TRUE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); |
| 214 prefs->SetBoolean(prefs::kAlternateErrorPagesEnabled, false); | 219 prefs->SetBoolean(prefs::kAlternateErrorPagesEnabled, false); |
| 215 | 220 |
| 216 EXPECT_TRUE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); | 221 EXPECT_TRUE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); |
| 217 prefs->SetBoolean(prefs::kSearchSuggestEnabled, false); | 222 prefs->SetBoolean(prefs::kSearchSuggestEnabled, false); |
| 218 } | 223 } |
| 219 | 224 |
| 220 // Verify the security preference under privacy across restarts. Part2 | 225 // Verify the security preference under privacy across restarts. Part2 |
| 221 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestPrivacySecurityPrefs) { | 226 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestPrivacySecurityPrefs) { |
| 222 PrefService* prefs = browser()->profile()->GetPrefs(); | 227 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 223 | 228 |
| 224 EXPECT_FALSE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); | 229 EXPECT_EQ(chrome_browser_net::NETWORK_PREDICTION_NEVER, |
| 230 prefs->GetInteger(prefs::kNetworkPredictionOptions)); | |
| 225 EXPECT_FALSE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); | 231 EXPECT_FALSE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); |
| 226 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); | 232 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); |
| 227 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); | 233 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); |
| 228 } | 234 } |
| 229 | 235 |
| 230 // Verify that we have some Local State prefs. | 236 // Verify that we have some Local State prefs. |
| 231 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestHaveLocalStatePrefs) { | 237 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestHaveLocalStatePrefs) { |
| 232 EXPECT_TRUE(g_browser_process->local_state()->GetPreferenceValues().get()); | 238 EXPECT_TRUE(g_browser_process->local_state()->GetPreferenceValues().get()); |
| 233 } | 239 } |
| 234 | 240 |
| OLD | NEW |