| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 ui_test_utils::SendToOmniboxAndSubmit(location_bar, "http://google.com/"); | 1095 ui_test_utils::SendToOmniboxAndSubmit(location_bar, "http://google.com/"); |
| 1096 OmniboxEditModel* model = location_bar->GetOmniboxView()->model(); | 1096 OmniboxEditModel* model = location_bar->GetOmniboxView()->model(); |
| 1097 no_safesearch_observer.Wait(); | 1097 no_safesearch_observer.Wait(); |
| 1098 EXPECT_TRUE(model->CurrentMatch(NULL).destination_url.is_valid()); | 1098 EXPECT_TRUE(model->CurrentMatch(NULL).destination_url.is_valid()); |
| 1099 content::WebContents* web_contents = | 1099 content::WebContents* web_contents = |
| 1100 browser()->tab_strip_model()->GetActiveWebContents(); | 1100 browser()->tab_strip_model()->GetActiveWebContents(); |
| 1101 GURL expected_without("http://google.com/"); | 1101 GURL expected_without("http://google.com/"); |
| 1102 EXPECT_EQ(expected_without, web_contents->GetURL()); | 1102 EXPECT_EQ(expected_without, web_contents->GetURL()); |
| 1103 | 1103 |
| 1104 PrefService* prefs = browser()->profile()->GetPrefs(); | 1104 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 1105 EXPECT_FALSE(prefs->IsManagedPreference(prefs::kForceSafeSearch)); | 1105 EXPECT_FALSE(prefs->IsManagedPreference(prefs::kForceGoogleSafeSearch)); |
| 1106 EXPECT_FALSE(prefs->GetBoolean(prefs::kForceSafeSearch)); | 1106 EXPECT_FALSE(prefs->GetBoolean(prefs::kForceGoogleSafeSearch)); |
| 1107 | 1107 |
| 1108 // Override the default SafeSearch setting using policies. | 1108 // Override the default SafeSearch setting using policies. |
| 1109 PolicyMap policies; | 1109 PolicyMap policies; |
| 1110 policies.Set(key::kForceSafeSearch, | 1110 policies.Set(key::kForceGoogleSafeSearch, |
| 1111 POLICY_LEVEL_MANDATORY, | 1111 POLICY_LEVEL_MANDATORY, |
| 1112 POLICY_SCOPE_USER, | 1112 POLICY_SCOPE_USER, |
| 1113 new base::FundamentalValue(true), | 1113 new base::FundamentalValue(true), |
| 1114 NULL); | 1114 NULL); |
| 1115 UpdateProviderPolicy(policies); | 1115 UpdateProviderPolicy(policies); |
| 1116 | 1116 |
| 1117 EXPECT_TRUE(prefs->IsManagedPreference(prefs::kForceSafeSearch)); | 1117 EXPECT_TRUE(prefs->IsManagedPreference(prefs::kForceGoogleSafeSearch)); |
| 1118 EXPECT_TRUE(prefs->GetBoolean(prefs::kForceSafeSearch)); | 1118 EXPECT_TRUE(prefs->GetBoolean(prefs::kForceGoogleSafeSearch)); |
| 1119 | 1119 |
| 1120 content::TestNavigationObserver safesearch_observer( | 1120 content::TestNavigationObserver safesearch_observer( |
| 1121 browser()->tab_strip_model()->GetActiveWebContents()); | 1121 browser()->tab_strip_model()->GetActiveWebContents()); |
| 1122 | 1122 |
| 1123 // Verify that searching from google.com works. | 1123 // Verify that searching from google.com works. |
| 1124 chrome::FocusLocationBar(browser()); | 1124 chrome::FocusLocationBar(browser()); |
| 1125 ui_test_utils::SendToOmniboxAndSubmit(location_bar, "http://google.com/"); | 1125 ui_test_utils::SendToOmniboxAndSubmit(location_bar, "http://google.com/"); |
| 1126 safesearch_observer.Wait(); | 1126 safesearch_observer.Wait(); |
| 1127 EXPECT_TRUE(model->CurrentMatch(NULL).destination_url.is_valid()); | 1127 EXPECT_TRUE(model->CurrentMatch(NULL).destination_url.is_valid()); |
| 1128 web_contents = browser()->tab_strip_model()->GetActiveWebContents(); | 1128 web_contents = browser()->tab_strip_model()->GetActiveWebContents(); |
| (...skipping 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 PrefService* prefs = browser()->profile()->GetPrefs(); | 3662 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 3663 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( | 3663 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( |
| 3664 prefs, "host.name")); | 3664 prefs, "host.name")); |
| 3665 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( | 3665 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( |
| 3666 prefs, "other.host.name")); | 3666 prefs, "other.host.name")); |
| 3667 } | 3667 } |
| 3668 | 3668 |
| 3669 #endif // !defined(CHROME_OS) | 3669 #endif // !defined(CHROME_OS) |
| 3670 | 3670 |
| 3671 } // namespace policy | 3671 } // namespace policy |
| OLD | NEW |