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

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

Issue 2671743002: Separate state of basic and advanced tab in CBD dialog (Closed)
Patch Set: rebase and fix compilation 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #include "chrome/common/chrome_paths.h" 88 #include "chrome/common/chrome_paths.h"
89 #include "chrome/common/chrome_switches.h" 89 #include "chrome/common/chrome_switches.h"
90 #include "chrome/common/extensions/extension_constants.h" 90 #include "chrome/common/extensions/extension_constants.h"
91 #include "chrome/common/pref_names.h" 91 #include "chrome/common/pref_names.h"
92 #include "chrome/common/url_constants.h" 92 #include "chrome/common/url_constants.h"
93 #include "chrome/grit/generated_resources.h" 93 #include "chrome/grit/generated_resources.h"
94 #include "chrome/test/base/in_process_browser_test.h" 94 #include "chrome/test/base/in_process_browser_test.h"
95 #include "chrome/test/base/search_test_utils.h" 95 #include "chrome/test/base/search_test_utils.h"
96 #include "chrome/test/base/ui_test_utils.h" 96 #include "chrome/test/base/ui_test_utils.h"
97 #include "components/bookmarks/common/bookmark_pref_names.h" 97 #include "components/bookmarks/common/bookmark_pref_names.h"
98 #include "components/browsing_data/core/pref_names.h"
98 #include "components/component_updater/component_updater_service.h" 99 #include "components/component_updater/component_updater_service.h"
99 #include "components/content_settings/core/common/content_settings.h" 100 #include "components/content_settings/core/common/content_settings.h"
100 #include "components/content_settings/core/common/content_settings_pattern.h" 101 #include "components/content_settings/core/common/content_settings_pattern.h"
101 #include "components/content_settings/core/common/pref_names.h" 102 #include "components/content_settings/core/common/pref_names.h"
102 #include "components/infobars/core/infobar.h" 103 #include "components/infobars/core/infobar.h"
103 #include "components/omnibox/browser/autocomplete_controller.h" 104 #include "components/omnibox/browser/autocomplete_controller.h"
104 #include "components/omnibox/browser/omnibox_edit_model.h" 105 #include "components/omnibox/browser/omnibox_edit_model.h"
105 #include "components/omnibox/browser/omnibox_view.h" 106 #include "components/omnibox/browser/omnibox_view.h"
106 #include "components/policy/core/browser/browser_policy_connector.h" 107 #include "components/policy/core/browser/browser_policy_connector.h"
107 #include "components/policy/core/common/external_data_fetcher.h" 108 #include "components/policy/core/common/external_data_fetcher.h"
(...skipping 2104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 2213 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
2213 base::MakeUnique<base::Value>(false), nullptr); 2214 base::MakeUnique<base::Value>(false), nullptr);
2214 UpdateProviderPolicy(policies); 2215 UpdateProviderPolicy(policies);
2215 ui_test_utils::NavigateToURL(browser(), url); 2216 ui_test_utils::NavigateToURL(browser(), url);
2216 // Verify that the navigation was saved in the history. 2217 // Verify that the navigation was saved in the history.
2217 ui_test_utils::HistoryEnumerator enumerator2(browser()->profile()); 2218 ui_test_utils::HistoryEnumerator enumerator2(browser()->profile());
2218 ASSERT_EQ(1u, enumerator2.urls().size()); 2219 ASSERT_EQ(1u, enumerator2.urls().size());
2219 EXPECT_EQ(url, enumerator2.urls()[0]); 2220 EXPECT_EQ(url, enumerator2.urls()[0]);
2220 } 2221 }
2221 2222
2223 IN_PROC_BROWSER_TEST_F(PolicyTest, DeletingBrowsingHistoryDisabled) {
2224 // Verifies that deleting the browsing history can be disabled.
2225
2226 PrefService* prefs = browser()->profile()->GetPrefs();
2227 EXPECT_FALSE(prefs->IsManagedPreference(prefs::kAllowDeletingBrowserHistory));
2228 EXPECT_TRUE(prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory));
2229
2230 EXPECT_TRUE(prefs->GetBoolean(browsing_data::prefs::kDeleteBrowsingHistory));
2231 EXPECT_TRUE(prefs->GetBoolean(browsing_data::prefs::kDeleteDownloadHistory));
2232 EXPECT_TRUE(
2233 prefs->GetBoolean(browsing_data::prefs::kDeleteBrowsingHistoryBasic));
2234
2235 PolicyMap policies;
2236 policies.Set(key::kAllowDeletingBrowserHistory, POLICY_LEVEL_MANDATORY,
2237 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
2238 base::MakeUnique<base::Value>(true), nullptr);
2239 UpdateProviderPolicy(policies);
2240 EXPECT_TRUE(prefs->IsManagedPreference(prefs::kAllowDeletingBrowserHistory));
2241 EXPECT_TRUE(prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory));
2242
2243 EXPECT_TRUE(prefs->GetBoolean(browsing_data::prefs::kDeleteBrowsingHistory));
2244 EXPECT_TRUE(prefs->GetBoolean(browsing_data::prefs::kDeleteDownloadHistory));
2245 EXPECT_TRUE(
2246 prefs->GetBoolean(browsing_data::prefs::kDeleteBrowsingHistoryBasic));
2247
2248 policies.Set(key::kAllowDeletingBrowserHistory, POLICY_LEVEL_MANDATORY,
2249 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
2250 base::MakeUnique<base::Value>(false), nullptr);
2251 UpdateProviderPolicy(policies);
2252 EXPECT_TRUE(prefs->IsManagedPreference(prefs::kAllowDeletingBrowserHistory));
2253 EXPECT_FALSE(prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory));
2254
2255 EXPECT_FALSE(prefs->GetBoolean(browsing_data::prefs::kDeleteBrowsingHistory));
2256 EXPECT_FALSE(prefs->GetBoolean(browsing_data::prefs::kDeleteDownloadHistory));
2257 EXPECT_FALSE(
2258 prefs->GetBoolean(browsing_data::prefs::kDeleteBrowsingHistoryBasic));
2259
2260 policies.Clear();
2261 UpdateProviderPolicy(policies);
2262 EXPECT_FALSE(prefs->IsManagedPreference(prefs::kAllowDeletingBrowserHistory));
2263 EXPECT_TRUE(prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory));
2264
2265 EXPECT_TRUE(prefs->GetBoolean(browsing_data::prefs::kDeleteBrowsingHistory));
2266 EXPECT_TRUE(prefs->GetBoolean(browsing_data::prefs::kDeleteDownloadHistory));
2267 EXPECT_TRUE(
2268 prefs->GetBoolean(browsing_data::prefs::kDeleteBrowsingHistoryBasic));
2269 }
2270
2222 // TODO(port): Test corresponding bubble translate UX: http://crbug.com/383235 2271 // TODO(port): Test corresponding bubble translate UX: http://crbug.com/383235
2223 #if !defined(USE_AURA) 2272 #if !defined(USE_AURA)
2224 // http://crbug.com/241691 PolicyTest.TranslateEnabled is failing regularly. 2273 // http://crbug.com/241691 PolicyTest.TranslateEnabled is failing regularly.
2225 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) { 2274 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) {
2226 // Verifies that translate can be forced enabled or disabled by policy. 2275 // Verifies that translate can be forced enabled or disabled by policy.
2227 2276
2228 // Get the InfoBarService, and verify that there are no infobars on startup. 2277 // Get the InfoBarService, and verify that there are no infobars on startup.
2229 content::WebContents* contents = 2278 content::WebContents* contents =
2230 browser()->tab_strip_model()->GetActiveWebContents(); 2279 browser()->tab_strip_model()->GetActiveWebContents();
2231 ASSERT_TRUE(contents); 2280 ASSERT_TRUE(contents);
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after
4401 4450
4402 SetEmptyPolicy(); 4451 SetEmptyPolicy();
4403 // Policy not set. 4452 // Policy not set.
4404 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); 4453 CheckSystemTimezoneAutomaticDetectionPolicyUnset();
4405 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); 4454 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false));
4406 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); 4455 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests());
4407 } 4456 }
4408 #endif // defined(OS_CHROMEOS) 4457 #endif // defined(OS_CHROMEOS)
4409 4458
4410 } // namespace policy 4459 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698