| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #include "chrome/common/extensions/extension_constants.h" | 78 #include "chrome/common/extensions/extension_constants.h" |
| 79 #include "chrome/common/extensions/extension_set.h" | 79 #include "chrome/common/extensions/extension_set.h" |
| 80 #include "chrome/common/pref_names.h" | 80 #include "chrome/common/pref_names.h" |
| 81 #include "chrome/common/url_constants.h" | 81 #include "chrome/common/url_constants.h" |
| 82 #include "chrome/test/base/in_process_browser_test.h" | 82 #include "chrome/test/base/in_process_browser_test.h" |
| 83 #include "chrome/test/base/test_switches.h" | 83 #include "chrome/test/base/test_switches.h" |
| 84 #include "chrome/test/base/ui_test_utils.h" | 84 #include "chrome/test/base/ui_test_utils.h" |
| 85 #include "components/policy/core/common/external_data_fetcher.h" | 85 #include "components/policy/core/common/external_data_fetcher.h" |
| 86 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 86 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
| 87 #include "components/policy/core/common/policy_map.h" | 87 #include "components/policy/core/common/policy_map.h" |
| 88 #include "components/policy/core/common/policy_pref_names.h" |
| 88 #include "components/policy/core/common/policy_service.h" | 89 #include "components/policy/core/common/policy_service.h" |
| 89 #include "components/policy/core/common/policy_service_impl.h" | 90 #include "components/policy/core/common/policy_service_impl.h" |
| 90 #include "content/public/browser/browser_child_process_host_iterator.h" | 91 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 91 #include "content/public/browser/browser_context.h" | 92 #include "content/public/browser/browser_context.h" |
| 92 #include "content/public/browser/browser_thread.h" | 93 #include "content/public/browser/browser_thread.h" |
| 93 #include "content/public/browser/child_process_data.h" | 94 #include "content/public/browser/child_process_data.h" |
| 94 #include "content/public/browser/download_item.h" | 95 #include "content/public/browser/download_item.h" |
| 95 #include "content/public/browser/download_manager.h" | 96 #include "content/public/browser/download_manager.h" |
| 96 #include "content/public/browser/gpu_data_manager.h" | 97 #include "content/public/browser/gpu_data_manager.h" |
| 97 #include "content/public/browser/notification_details.h" | 98 #include "content/public/browser/notification_details.h" |
| (...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 CheckURLIsBlocked(browser(), file_path2.c_str()); | 1993 CheckURLIsBlocked(browser(), file_path2.c_str()); |
| 1993 | 1994 |
| 1994 // Replace the URLblacklist with disabling the file scheme. | 1995 // Replace the URLblacklist with disabling the file scheme. |
| 1995 blacklist.Remove(base::StringValue("file://*"), NULL); | 1996 blacklist.Remove(base::StringValue("file://*"), NULL); |
| 1996 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, | 1997 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, |
| 1997 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL); | 1998 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL); |
| 1998 UpdateProviderPolicy(policies); | 1999 UpdateProviderPolicy(policies); |
| 1999 FlushBlacklistPolicy(); | 2000 FlushBlacklistPolicy(); |
| 2000 | 2001 |
| 2001 PrefService* prefs = browser()->profile()->GetPrefs(); | 2002 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 2002 const base::ListValue* list_url = prefs->GetList(prefs::kUrlBlacklist); | 2003 const base::ListValue* list_url = prefs->GetList(policy_prefs::kUrlBlacklist); |
| 2003 EXPECT_EQ(list_url->Find(base::StringValue("file://*")), | 2004 EXPECT_EQ(list_url->Find(base::StringValue("file://*")), |
| 2004 list_url->end()); | 2005 list_url->end()); |
| 2005 | 2006 |
| 2006 base::ListValue disabledscheme; | 2007 base::ListValue disabledscheme; |
| 2007 disabledscheme.Append(base::Value::CreateStringValue("file")); | 2008 disabledscheme.Append(base::Value::CreateStringValue("file")); |
| 2008 policies.Set(key::kDisabledSchemes, POLICY_LEVEL_MANDATORY, | 2009 policies.Set(key::kDisabledSchemes, POLICY_LEVEL_MANDATORY, |
| 2009 POLICY_SCOPE_USER, disabledscheme.DeepCopy(), NULL); | 2010 POLICY_SCOPE_USER, disabledscheme.DeepCopy(), NULL); |
| 2010 UpdateProviderPolicy(policies); | 2011 UpdateProviderPolicy(policies); |
| 2011 FlushBlacklistPolicy(); | 2012 FlushBlacklistPolicy(); |
| 2012 | 2013 |
| 2013 list_url = prefs->GetList(prefs::kUrlBlacklist); | 2014 list_url = prefs->GetList(policy_prefs::kUrlBlacklist); |
| 2014 EXPECT_NE(list_url->Find(base::StringValue("file://*")), | 2015 EXPECT_NE(list_url->Find(base::StringValue("file://*")), |
| 2015 list_url->end()); | 2016 list_url->end()); |
| 2016 | 2017 |
| 2017 // Whitelist one folder and blacklist an another just inside. | 2018 // Whitelist one folder and blacklist an another just inside. |
| 2018 base::ListValue whitelist; | 2019 base::ListValue whitelist; |
| 2019 whitelist.Append(base::Value::CreateStringValue(base_path)); | 2020 whitelist.Append(base::Value::CreateStringValue(base_path)); |
| 2020 policies.Set(key::kURLWhitelist, POLICY_LEVEL_MANDATORY, | 2021 policies.Set(key::kURLWhitelist, POLICY_LEVEL_MANDATORY, |
| 2021 POLICY_SCOPE_USER, whitelist.DeepCopy(), NULL); | 2022 POLICY_SCOPE_USER, whitelist.DeepCopy(), NULL); |
| 2022 blacklist.Append(base::Value::CreateStringValue(folder_path)); | 2023 blacklist.Append(base::Value::CreateStringValue(folder_path)); |
| 2023 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, | 2024 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2870 chrome_variations::VariationsService::GetVariationsServerURL( | 2871 chrome_variations::VariationsService::GetVariationsServerURL( |
| 2871 g_browser_process->local_state()); | 2872 g_browser_process->local_state()); |
| 2872 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); | 2873 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); |
| 2873 std::string value; | 2874 std::string value; |
| 2874 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 2875 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
| 2875 EXPECT_EQ("restricted", value); | 2876 EXPECT_EQ("restricted", value); |
| 2876 } | 2877 } |
| 2877 #endif | 2878 #endif |
| 2878 | 2879 |
| 2879 } // namespace policy | 2880 } // namespace policy |
| OLD | NEW |