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

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

Issue 1861383002: Add TaskManagerEndProcessEnabled policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update supported_on to 52 Created 4 years, 8 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 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "chrome/browser/policy/cloud/test_request_interceptor.h" 61 #include "chrome/browser/policy/cloud/test_request_interceptor.h"
62 #include "chrome/browser/policy/profile_policy_connector.h" 62 #include "chrome/browser/policy/profile_policy_connector.h"
63 #include "chrome/browser/policy/profile_policy_connector_factory.h" 63 #include "chrome/browser/policy/profile_policy_connector_factory.h"
64 #include "chrome/browser/prefs/session_startup_pref.h" 64 #include "chrome/browser/prefs/session_startup_pref.h"
65 #include "chrome/browser/profiles/profile.h" 65 #include "chrome/browser/profiles/profile.h"
66 #include "chrome/browser/search/instant_service.h" 66 #include "chrome/browser/search/instant_service.h"
67 #include "chrome/browser/search/instant_service_factory.h" 67 #include "chrome/browser/search/instant_service_factory.h"
68 #include "chrome/browser/search/search.h" 68 #include "chrome/browser/search/search.h"
69 #include "chrome/browser/search_engines/template_url_service_factory.h" 69 #include "chrome/browser/search_engines/template_url_service_factory.h"
70 #include "chrome/browser/ssl/ssl_blocking_page.h" 70 #include "chrome/browser/ssl/ssl_blocking_page.h"
71 #include "chrome/browser/task_manager/task_manager.h"
71 #include "chrome/browser/translate/chrome_translate_client.h" 72 #include "chrome/browser/translate/chrome_translate_client.h"
72 #include "chrome/browser/translate/cld_data_harness.h" 73 #include "chrome/browser/translate/cld_data_harness.h"
73 #include "chrome/browser/translate/cld_data_harness_factory.h" 74 #include "chrome/browser/translate/cld_data_harness_factory.h"
74 #include "chrome/browser/translate/translate_service.h" 75 #include "chrome/browser/translate/translate_service.h"
75 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" 76 #include "chrome/browser/ui/bookmarks/bookmark_bar.h"
76 #include "chrome/browser/ui/browser.h" 77 #include "chrome/browser/ui/browser.h"
77 #include "chrome/browser/ui/browser_commands.h" 78 #include "chrome/browser/ui/browser_commands.h"
78 #include "chrome/browser/ui/browser_list.h" 79 #include "chrome/browser/ui/browser_list.h"
79 #include "chrome/browser/ui/browser_tabstrip.h" 80 #include "chrome/browser/ui/browser_tabstrip.h"
80 #include "chrome/browser/ui/browser_window.h" 81 #include "chrome/browser/ui/browser_window.h"
(...skipping 3767 matching lines...) Expand 10 before | Expand all | Expand 10 after
3848 static_cast<SSLBlockingPage*>(interstitial_delegate); 3849 static_cast<SSLBlockingPage*>(interstitial_delegate);
3849 ssl_delegate->CommandReceived( 3850 ssl_delegate->CommandReceived(
3850 base::IntToString(security_interstitials::CMD_PROCEED)); 3851 base::IntToString(security_interstitials::CMD_PROCEED));
3851 EXPECT_TRUE(interstitial); 3852 EXPECT_TRUE(interstitial);
3852 EXPECT_TRUE(browser() 3853 EXPECT_TRUE(browser()
3853 ->tab_strip_model() 3854 ->tab_strip_model()
3854 ->GetActiveWebContents() 3855 ->GetActiveWebContents()
3855 ->ShowingInterstitialPage()); 3856 ->ShowingInterstitialPage());
3856 } 3857 }
3857 3858
3859 // Test that TaskManager::IsEndProcessEnabled is controlled by
3860 // TaskManagerEndProcessEnabled policy
3861 IN_PROC_BROWSER_TEST_F(PolicyTest, TaskManagerEndProcessEnabled) {
3862 // By default it's allowed to end tasks.
3863 EXPECT_TRUE(TaskManager::IsEndProcessEnabled());
3864
3865 // Disabling ending tasks in task manager by policy
3866 PolicyMap policies1;
3867 policies1.Set(key::kTaskManagerEndProcessEnabled, POLICY_LEVEL_MANDATORY,
3868 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
3869 new base::FundamentalValue(false), nullptr);
3870 UpdateProviderPolicy(policies1);
3871
3872 // Policy should not allow ending tasks anymore.
3873 EXPECT_FALSE(TaskManager::IsEndProcessEnabled());
3874
3875 // Enabling ending tasks in task manager by policy
3876 PolicyMap policies2;
3877 policies2.Set(key::kTaskManagerEndProcessEnabled, POLICY_LEVEL_MANDATORY,
3878 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
3879 new base::FundamentalValue(true), nullptr);
3880 UpdateProviderPolicy(policies2);
3881
3882 // Policy should allow ending tasks again.
3883 EXPECT_TRUE(TaskManager::IsEndProcessEnabled());
3884 }
3885
3858 #if !defined(OS_CHROMEOS) 3886 #if !defined(OS_CHROMEOS)
3859 // Similar to PolicyTest but sets the proper policy before the browser is 3887 // Similar to PolicyTest but sets the proper policy before the browser is
3860 // started. 3888 // started.
3861 class PolicyVariationsServiceTest : public PolicyTest { 3889 class PolicyVariationsServiceTest : public PolicyTest {
3862 public: 3890 public:
3863 void SetUpInProcessBrowserTestFixture() override { 3891 void SetUpInProcessBrowserTestFixture() override {
3864 PolicyTest::SetUpInProcessBrowserTestFixture(); 3892 PolicyTest::SetUpInProcessBrowserTestFixture();
3865 PolicyMap policies; 3893 PolicyMap policies;
3866 policies.Set(key::kVariationsRestrictParameter, 3894 policies.Set(key::kVariationsRestrictParameter,
3867 POLICY_LEVEL_MANDATORY, 3895 POLICY_LEVEL_MANDATORY,
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
4227 4255
4228 SetEmptyPolicy(); 4256 SetEmptyPolicy();
4229 // Policy not set. 4257 // Policy not set.
4230 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); 4258 CheckSystemTimezoneAutomaticDetectionPolicyUnset();
4231 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); 4259 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false));
4232 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); 4260 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests());
4233 } 4261 }
4234 #endif // defined(OS_CHROMEOS) 4262 #endif // defined(OS_CHROMEOS)
4235 4263
4236 } // namespace policy 4264 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698