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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 class LocalePolicyTest : public PolicyTest { 849 class LocalePolicyTest : public PolicyTest {
850 public: 850 public:
851 LocalePolicyTest() {} 851 LocalePolicyTest() {}
852 ~LocalePolicyTest() override {} 852 ~LocalePolicyTest() override {}
853 853
854 void SetUpInProcessBrowserTestFixture() override { 854 void SetUpInProcessBrowserTestFixture() override {
855 PolicyTest::SetUpInProcessBrowserTestFixture(); 855 PolicyTest::SetUpInProcessBrowserTestFixture();
856 PolicyMap policies; 856 PolicyMap policies;
857 policies.Set(key::kApplicationLocaleValue, POLICY_LEVEL_MANDATORY, 857 policies.Set(key::kApplicationLocaleValue, POLICY_LEVEL_MANDATORY,
858 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 858 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
859 base::MakeUnique<base::StringValue>("fr"), nullptr); 859 base::MakeUnique<base::Value>("fr"), nullptr);
860 provider_.UpdateChromePolicy(policies); 860 provider_.UpdateChromePolicy(policies);
861 // The "en-US" ResourceBundle is always loaded before this step for tests, 861 // The "en-US" ResourceBundle is always loaded before this step for tests,
862 // but in this test we want the browser to load the bundle as it 862 // but in this test we want the browser to load the bundle as it
863 // normally would. 863 // normally would.
864 ResourceBundle::CleanupSharedInstance(); 864 ResourceBundle::CleanupSharedInstance();
865 } 865 }
866 }; 866 };
867 867
868 IN_PROC_BROWSER_TEST_F(LocalePolicyTest, ApplicationLocaleValue) { 868 IN_PROC_BROWSER_TEST_F(LocalePolicyTest, ApplicationLocaleValue) {
869 // Verifies that the default locale can be overridden with policy. 869 // Verifies that the default locale can be overridden with policy.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 default_search->image_url_post_params() == kImageURLPostParams && 988 default_search->image_url_post_params() == kImageURLPostParams &&
989 default_search->new_tab_url() == kNewTabURL); 989 default_search->new_tab_url() == kNewTabURL);
990 990
991 // Override the default search provider using policies. 991 // Override the default search provider using policies.
992 PolicyMap policies; 992 PolicyMap policies;
993 policies.Set(key::kDefaultSearchProviderEnabled, POLICY_LEVEL_MANDATORY, 993 policies.Set(key::kDefaultSearchProviderEnabled, POLICY_LEVEL_MANDATORY,
994 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 994 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
995 base::MakeUnique<base::Value>(true), nullptr); 995 base::MakeUnique<base::Value>(true), nullptr);
996 policies.Set(key::kDefaultSearchProviderKeyword, POLICY_LEVEL_MANDATORY, 996 policies.Set(key::kDefaultSearchProviderKeyword, POLICY_LEVEL_MANDATORY,
997 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 997 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
998 base::MakeUnique<base::StringValue>(kKeyword), nullptr); 998 base::MakeUnique<base::Value>(kKeyword), nullptr);
999 policies.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY, 999 policies.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY,
1000 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 1000 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
1001 base::MakeUnique<base::StringValue>(kSearchURL), nullptr); 1001 base::MakeUnique<base::Value>(kSearchURL), nullptr);
1002 policies.Set(key::kDefaultSearchProviderInstantURL, POLICY_LEVEL_MANDATORY, 1002 policies.Set(key::kDefaultSearchProviderInstantURL, POLICY_LEVEL_MANDATORY,
1003 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 1003 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
1004 base::MakeUnique<base::StringValue>(kInstantURL), nullptr); 1004 base::MakeUnique<base::Value>(kInstantURL), nullptr);
1005 std::unique_ptr<base::ListValue> alternate_urls(new base::ListValue); 1005 std::unique_ptr<base::ListValue> alternate_urls(new base::ListValue);
1006 alternate_urls->AppendString(kAlternateURL0); 1006 alternate_urls->AppendString(kAlternateURL0);
1007 alternate_urls->AppendString(kAlternateURL1); 1007 alternate_urls->AppendString(kAlternateURL1);
1008 policies.Set(key::kDefaultSearchProviderAlternateURLs, POLICY_LEVEL_MANDATORY, 1008 policies.Set(key::kDefaultSearchProviderAlternateURLs, POLICY_LEVEL_MANDATORY,
1009 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 1009 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
1010 std::move(alternate_urls), nullptr); 1010 std::move(alternate_urls), nullptr);
1011 policies.Set(key::kDefaultSearchProviderSearchTermsReplacementKey, 1011 policies.Set(key::kDefaultSearchProviderSearchTermsReplacementKey,
1012 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 1012 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
1013 base::MakeUnique<base::StringValue>(kSearchTermsReplacementKey), 1013 base::MakeUnique<base::Value>(kSearchTermsReplacementKey),
1014 nullptr); 1014 nullptr);
1015 policies.Set(key::kDefaultSearchProviderImageURL, POLICY_LEVEL_MANDATORY, 1015 policies.Set(key::kDefaultSearchProviderImageURL, POLICY_LEVEL_MANDATORY,
1016 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 1016 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
1017 base::MakeUnique<base::StringValue>(kImageURL), nullptr); 1017 base::MakeUnique<base::Value>(kImageURL), nullptr);
1018 policies.Set(key::kDefaultSearchProviderImageURLPostParams, 1018 policies.Set(key::kDefaultSearchProviderImageURLPostParams,
1019 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 1019 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
1020 base::MakeUnique<base::StringValue>(kImageURLPostParams), 1020 base::MakeUnique<base::Value>(kImageURLPostParams), nullptr);
1021 nullptr);
1022 policies.Set(key::kDefaultSearchProviderNewTabURL, POLICY_LEVEL_MANDATORY, 1021 policies.Set(key::kDefaultSearchProviderNewTabURL, POLICY_LEVEL_MANDATORY,
1023 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 1022 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
1024 base::MakeUnique<base::StringValue>(kNewTabURL), nullptr); 1023 base::MakeUnique<base::Value>(kNewTabURL), nullptr);
1025 UpdateProviderPolicy(policies); 1024 UpdateProviderPolicy(policies);
1026 default_search = service->GetDefaultSearchProvider(); 1025 default_search = service->GetDefaultSearchProvider();
1027 ASSERT_TRUE(default_search); 1026 ASSERT_TRUE(default_search);
1028 EXPECT_EQ(kKeyword, default_search->keyword()); 1027 EXPECT_EQ(kKeyword, default_search->keyword());
1029 EXPECT_EQ(kSearchURL, default_search->url()); 1028 EXPECT_EQ(kSearchURL, default_search->url());
1030 EXPECT_EQ(kInstantURL, default_search->instant_url()); 1029 EXPECT_EQ(kInstantURL, default_search->instant_url());
1031 EXPECT_EQ(2U, default_search->alternate_urls().size()); 1030 EXPECT_EQ(2U, default_search->alternate_urls().size());
1032 EXPECT_EQ(kAlternateURL0, default_search->alternate_urls()[0]); 1031 EXPECT_EQ(kAlternateURL0, default_search->alternate_urls()[0]);
1033 EXPECT_EQ(kAlternateURL1, default_search->alternate_urls()[1]); 1032 EXPECT_EQ(kAlternateURL1, default_search->alternate_urls()[1]);
1034 EXPECT_EQ(kSearchTermsReplacementKey, 1033 EXPECT_EQ(kSearchTermsReplacementKey,
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 1444
1446 // Verify that downloads end up on the default directory. 1445 // Verify that downloads end up on the default directory.
1447 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1446 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1448 DownloadAndVerifyFile(browser(), initial_dir.GetPath(), file); 1447 DownloadAndVerifyFile(browser(), initial_dir.GetPath(), file);
1449 base::DieFileDie(initial_dir.GetPath().Append(file), false); 1448 base::DieFileDie(initial_dir.GetPath().Append(file), false);
1450 1449
1451 // Override the download directory with the policy and verify a download. 1450 // Override the download directory with the policy and verify a download.
1452 base::ScopedTempDir forced_dir; 1451 base::ScopedTempDir forced_dir;
1453 ASSERT_TRUE(forced_dir.CreateUniqueTempDir()); 1452 ASSERT_TRUE(forced_dir.CreateUniqueTempDir());
1454 PolicyMap policies; 1453 PolicyMap policies;
1455 policies.Set( 1454 policies.Set(key::kDownloadDirectory, POLICY_LEVEL_MANDATORY,
1456 key::kDownloadDirectory, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 1455 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
1457 POLICY_SOURCE_CLOUD, 1456 base::MakeUnique<base::Value>(forced_dir.GetPath().value()),
1458 base::MakeUnique<base::StringValue>(forced_dir.GetPath().value()), 1457 nullptr);
1459 nullptr);
1460 UpdateProviderPolicy(policies); 1458 UpdateProviderPolicy(policies);
1461 DownloadAndVerifyFile(browser(), forced_dir.GetPath(), file); 1459 DownloadAndVerifyFile(browser(), forced_dir.GetPath(), file);
1462 // Verify that the first download location wasn't affected. 1460 // Verify that the first download location wasn't affected.
1463 EXPECT_FALSE(base::PathExists(initial_dir.GetPath().Append(file))); 1461 EXPECT_FALSE(base::PathExists(initial_dir.GetPath().Append(file)));
1464 } 1462 }
1465 1463
1466 IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallBlacklistSelective) { 1464 IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallBlacklistSelective) {
1467 // Verifies that blacklisted extensions can't be installed. 1465 // Verifies that blacklisted extensions can't be installed.
1468 ExtensionService* service = extension_service(); 1466 ExtensionService* service = extension_service();
1469 ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); 1467 ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true));
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 content::WebContents* contents = 2068 content::WebContents* contents =
2071 browser()->tab_strip_model()->GetActiveWebContents(); 2069 browser()->tab_strip_model()->GetActiveWebContents();
2072 EXPECT_EQ(GURL(url::kAboutBlankURL), contents->GetURL()); 2070 EXPECT_EQ(GURL(url::kAboutBlankURL), contents->GetURL());
2073 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); 2071 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME));
2074 EXPECT_EQ(GURL(chrome::kChromeUIPolicyURL), contents->GetURL()); 2072 EXPECT_EQ(GURL(chrome::kChromeUIPolicyURL), contents->GetURL());
2075 2073
2076 // Now override with policy. 2074 // Now override with policy.
2077 PolicyMap policies; 2075 PolicyMap policies;
2078 policies.Set(key::kHomepageLocation, POLICY_LEVEL_MANDATORY, 2076 policies.Set(key::kHomepageLocation, POLICY_LEVEL_MANDATORY,
2079 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 2077 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
2080 base::MakeUnique<base::StringValue>(chrome::kChromeUICreditsURL), 2078 base::MakeUnique<base::Value>(chrome::kChromeUICreditsURL),
2081 nullptr); 2079 nullptr);
2082 UpdateProviderPolicy(policies); 2080 UpdateProviderPolicy(policies);
2083 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); 2081 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME));
2084 content::WaitForLoadStop(contents); 2082 content::WaitForLoadStop(contents);
2085 EXPECT_EQ(GURL(chrome::kChromeUICreditsURL), contents->GetURL()); 2083 EXPECT_EQ(GURL(chrome::kChromeUICreditsURL), contents->GetURL());
2086 2084
2087 policies.Set(key::kHomepageIsNewTabPage, POLICY_LEVEL_MANDATORY, 2085 policies.Set(key::kHomepageIsNewTabPage, POLICY_LEVEL_MANDATORY,
2088 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 2086 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
2089 base::MakeUnique<base::Value>(true), nullptr); 2087 base::MakeUnique<base::Value>(true), nullptr);
2090 UpdateProviderPolicy(policies); 2088 UpdateProviderPolicy(policies);
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 PolicyMap policies; 2460 PolicyMap policies;
2463 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 2461 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
2464 POLICY_SOURCE_CLOUD, blacklist.CreateDeepCopy(), nullptr); 2462 POLICY_SOURCE_CLOUD, blacklist.CreateDeepCopy(), nullptr);
2465 UpdateProviderPolicy(policies); 2463 UpdateProviderPolicy(policies);
2466 FlushBlacklistPolicy(); 2464 FlushBlacklistPolicy();
2467 2465
2468 CheckURLIsBlocked(browser(), file_path1.c_str()); 2466 CheckURLIsBlocked(browser(), file_path1.c_str());
2469 CheckURLIsBlocked(browser(), file_path2.c_str()); 2467 CheckURLIsBlocked(browser(), file_path2.c_str());
2470 2468
2471 // Replace the URLblacklist with disabling the file scheme. 2469 // Replace the URLblacklist with disabling the file scheme.
2472 blacklist.Remove(base::StringValue("file://*"), NULL); 2470 blacklist.Remove(base::Value("file://*"), NULL);
2473 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 2471 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
2474 POLICY_SOURCE_CLOUD, blacklist.CreateDeepCopy(), nullptr); 2472 POLICY_SOURCE_CLOUD, blacklist.CreateDeepCopy(), nullptr);
2475 UpdateProviderPolicy(policies); 2473 UpdateProviderPolicy(policies);
2476 FlushBlacklistPolicy(); 2474 FlushBlacklistPolicy();
2477 2475
2478 PrefService* prefs = browser()->profile()->GetPrefs(); 2476 PrefService* prefs = browser()->profile()->GetPrefs();
2479 const base::ListValue* list_url = prefs->GetList(policy_prefs::kUrlBlacklist); 2477 const base::ListValue* list_url = prefs->GetList(policy_prefs::kUrlBlacklist);
2480 EXPECT_EQ(list_url->Find(base::StringValue("file://*")), 2478 EXPECT_EQ(list_url->Find(base::Value("file://*")), list_url->end());
2481 list_url->end());
2482 2479
2483 base::ListValue disabledscheme; 2480 base::ListValue disabledscheme;
2484 disabledscheme.AppendString("file"); 2481 disabledscheme.AppendString("file");
2485 policies.Set(key::kDisabledSchemes, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 2482 policies.Set(key::kDisabledSchemes, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
2486 POLICY_SOURCE_CLOUD, disabledscheme.CreateDeepCopy(), nullptr); 2483 POLICY_SOURCE_CLOUD, disabledscheme.CreateDeepCopy(), nullptr);
2487 UpdateProviderPolicy(policies); 2484 UpdateProviderPolicy(policies);
2488 FlushBlacklistPolicy(); 2485 FlushBlacklistPolicy();
2489 2486
2490 list_url = prefs->GetList(policy_prefs::kUrlBlacklist); 2487 list_url = prefs->GetList(policy_prefs::kUrlBlacklist);
2491 EXPECT_NE(list_url->Find(base::StringValue("file://*")), 2488 EXPECT_NE(list_url->Find(base::Value("file://*")), list_url->end());
2492 list_url->end());
2493 2489
2494 // Whitelist one folder and blacklist an another just inside. 2490 // Whitelist one folder and blacklist an another just inside.
2495 base::ListValue whitelist; 2491 base::ListValue whitelist;
2496 whitelist.AppendString(base_path); 2492 whitelist.AppendString(base_path);
2497 policies.Set(key::kURLWhitelist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 2493 policies.Set(key::kURLWhitelist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
2498 POLICY_SOURCE_CLOUD, whitelist.CreateDeepCopy(), nullptr); 2494 POLICY_SOURCE_CLOUD, whitelist.CreateDeepCopy(), nullptr);
2499 blacklist.AppendString(folder_path); 2495 blacklist.AppendString(folder_path);
2500 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 2496 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
2501 POLICY_SOURCE_CLOUD, blacklist.CreateDeepCopy(), nullptr); 2497 POLICY_SOURCE_CLOUD, blacklist.CreateDeepCopy(), nullptr);
2502 UpdateProviderPolicy(policies); 2498 UpdateProviderPolicy(policies);
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 PolicyTest::SetUpInProcessBrowserTestFixture(); 3068 PolicyTest::SetUpInProcessBrowserTestFixture();
3073 PolicyMap policies; 3069 PolicyMap policies;
3074 policies.Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY, 3070 policies.Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY,
3075 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 3071 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
3076 base::MakeUnique<base::Value>(true), nullptr); 3072 base::MakeUnique<base::Value>(true), nullptr);
3077 policies.Set(key::kBookmarkBarEnabled, POLICY_LEVEL_MANDATORY, 3073 policies.Set(key::kBookmarkBarEnabled, POLICY_LEVEL_MANDATORY,
3078 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 3074 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
3079 base::MakeUnique<base::Value>(false), nullptr); 3075 base::MakeUnique<base::Value>(false), nullptr);
3080 policies.Set(key::kHomepageLocation, POLICY_LEVEL_MANDATORY, 3076 policies.Set(key::kHomepageLocation, POLICY_LEVEL_MANDATORY,
3081 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 3077 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
3082 base::MakeUnique<base::StringValue>("http://chromium.org"), 3078 base::MakeUnique<base::Value>("http://chromium.org"), nullptr);
3083 nullptr);
3084 provider_.UpdateChromePolicy(policies); 3079 provider_.UpdateChromePolicy(policies);
3085 } 3080 }
3086 }; 3081 };
3087 3082
3088 IN_PROC_BROWSER_TEST_F(PolicyStatisticsCollectorTest, Startup) { 3083 IN_PROC_BROWSER_TEST_F(PolicyStatisticsCollectorTest, Startup) {
3089 // Verifies that policy usage histograms are collected at startup. 3084 // Verifies that policy usage histograms are collected at startup.
3090 3085
3091 // BrowserPolicyConnector::Init() has already been called. Make sure the 3086 // BrowserPolicyConnector::Init() has already been called. Make sure the
3092 // CompleteInitialization() task has executed as well. 3087 // CompleteInitialization() task has executed as well.
3093 content::RunAllPendingInMessageLoop(); 3088 content::RunAllPendingInMessageLoop();
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
3684 template <bool enable> 3679 template <bool enable>
3685 class WebRtcUdpPortRangePolicyTest : public PolicyTest { 3680 class WebRtcUdpPortRangePolicyTest : public PolicyTest {
3686 public: 3681 public:
3687 WebRtcUdpPortRangePolicyTest() = default; 3682 WebRtcUdpPortRangePolicyTest() = default;
3688 void SetUpInProcessBrowserTestFixture() override { 3683 void SetUpInProcessBrowserTestFixture() override {
3689 PolicyTest::SetUpInProcessBrowserTestFixture(); 3684 PolicyTest::SetUpInProcessBrowserTestFixture();
3690 PolicyMap policies; 3685 PolicyMap policies;
3691 if (enable) { 3686 if (enable) {
3692 policies.Set(key::kWebRtcUdpPortRange, POLICY_LEVEL_MANDATORY, 3687 policies.Set(key::kWebRtcUdpPortRange, POLICY_LEVEL_MANDATORY,
3693 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 3688 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
3694 base::MakeUnique<base::StringValue>(kTestWebRtcUdpPortRange), 3689 base::MakeUnique<base::Value>(kTestWebRtcUdpPortRange),
3695 nullptr); 3690 nullptr);
3696 } 3691 }
3697 provider_.UpdateChromePolicy(policies); 3692 provider_.UpdateChromePolicy(policies);
3698 } 3693 }
3699 3694
3700 private: 3695 private:
3701 DISALLOW_COPY_AND_ASSIGN(WebRtcUdpPortRangePolicyTest<enable>); 3696 DISALLOW_COPY_AND_ASSIGN(WebRtcUdpPortRangePolicyTest<enable>);
3702 }; 3697 };
3703 3698
3704 using WebRtcUdpPortRangeEnabledPolicyTest = WebRtcUdpPortRangePolicyTest<true>; 3699 using WebRtcUdpPortRangeEnabledPolicyTest = WebRtcUdpPortRangePolicyTest<true>;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
4006 #if !defined(OS_CHROMEOS) 4001 #if !defined(OS_CHROMEOS)
4007 // Similar to PolicyTest but sets the proper policy before the browser is 4002 // Similar to PolicyTest but sets the proper policy before the browser is
4008 // started. 4003 // started.
4009 class PolicyVariationsServiceTest : public PolicyTest { 4004 class PolicyVariationsServiceTest : public PolicyTest {
4010 public: 4005 public:
4011 void SetUpInProcessBrowserTestFixture() override { 4006 void SetUpInProcessBrowserTestFixture() override {
4012 PolicyTest::SetUpInProcessBrowserTestFixture(); 4007 PolicyTest::SetUpInProcessBrowserTestFixture();
4013 PolicyMap policies; 4008 PolicyMap policies;
4014 policies.Set(key::kVariationsRestrictParameter, POLICY_LEVEL_MANDATORY, 4009 policies.Set(key::kVariationsRestrictParameter, POLICY_LEVEL_MANDATORY,
4015 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 4010 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
4016 base::MakeUnique<base::StringValue>("restricted"), nullptr); 4011 base::MakeUnique<base::Value>("restricted"), nullptr);
4017 provider_.UpdateChromePolicy(policies); 4012 provider_.UpdateChromePolicy(policies);
4018 } 4013 }
4019 }; 4014 };
4020 4015
4021 IN_PROC_BROWSER_TEST_F(PolicyVariationsServiceTest, VariationsURLIsValid) { 4016 IN_PROC_BROWSER_TEST_F(PolicyVariationsServiceTest, VariationsURLIsValid) {
4022 const std::string default_variations_url = 4017 const std::string default_variations_url =
4023 variations::VariationsService::GetDefaultVariationsServerURLForTesting(); 4018 variations::VariationsService::GetDefaultVariationsServerURLForTesting();
4024 4019
4025 // g_browser_process->variations_service() is null by default in Chromium 4020 // g_browser_process->variations_service() is null by default in Chromium
4026 // builds, so construct a VariationsService locally instead. 4021 // builds, so construct a VariationsService locally instead.
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
4447 4442
4448 SetEmptyPolicy(); 4443 SetEmptyPolicy();
4449 // Policy not set. 4444 // Policy not set.
4450 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); 4445 CheckSystemTimezoneAutomaticDetectionPolicyUnset();
4451 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); 4446 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false));
4452 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); 4447 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests());
4453 } 4448 }
4454 #endif // defined(OS_CHROMEOS) 4449 #endif // defined(OS_CHROMEOS)
4455 4450
4456 } // namespace policy 4451 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698