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

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

Issue 490123003: Move bookmark_pref_names.* into bookmarks namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 6 years, 3 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 <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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 #if defined(OS_WIN) && defined(USE_ASH) 798 #if defined(OS_WIN) && defined(USE_ASH)
799 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 799 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
800 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 800 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
801 return; 801 return;
802 #endif 802 #endif
803 803
804 // Verifies that the bookmarks bar can be forced to always or never show up. 804 // Verifies that the bookmarks bar can be forced to always or never show up.
805 805
806 // Test starts in about:blank. 806 // Test starts in about:blank.
807 PrefService* prefs = browser()->profile()->GetPrefs(); 807 PrefService* prefs = browser()->profile()->GetPrefs();
808 EXPECT_FALSE(prefs->IsManagedPreference(prefs::kShowBookmarkBar)); 808 EXPECT_FALSE(prefs->IsManagedPreference(bookmarks::prefs::kShowBookmarkBar));
809 EXPECT_FALSE(prefs->GetBoolean(prefs::kShowBookmarkBar)); 809 EXPECT_FALSE(prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar));
810 EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); 810 EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state());
811 811
812 PolicyMap policies; 812 PolicyMap policies;
813 policies.Set(key::kBookmarkBarEnabled, 813 policies.Set(key::kBookmarkBarEnabled,
814 POLICY_LEVEL_MANDATORY, 814 POLICY_LEVEL_MANDATORY,
815 POLICY_SCOPE_USER, 815 POLICY_SCOPE_USER,
816 new base::FundamentalValue(true), 816 new base::FundamentalValue(true),
817 NULL); 817 NULL);
818 UpdateProviderPolicy(policies); 818 UpdateProviderPolicy(policies);
819 EXPECT_TRUE(prefs->IsManagedPreference(prefs::kShowBookmarkBar)); 819 EXPECT_TRUE(prefs->IsManagedPreference(bookmarks::prefs::kShowBookmarkBar));
820 EXPECT_TRUE(prefs->GetBoolean(prefs::kShowBookmarkBar)); 820 EXPECT_TRUE(prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar));
821 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); 821 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state());
822 822
823 // The NTP has special handling of the bookmark bar. 823 // The NTP has special handling of the bookmark bar.
824 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); 824 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
825 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); 825 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state());
826 826
827 policies.Set(key::kBookmarkBarEnabled, 827 policies.Set(key::kBookmarkBarEnabled,
828 POLICY_LEVEL_MANDATORY, 828 POLICY_LEVEL_MANDATORY,
829 POLICY_SCOPE_USER, 829 POLICY_SCOPE_USER,
830 new base::FundamentalValue(false), 830 new base::FundamentalValue(false),
831 NULL); 831 NULL);
832 UpdateProviderPolicy(policies); 832 UpdateProviderPolicy(policies);
833 EXPECT_TRUE(prefs->IsManagedPreference(prefs::kShowBookmarkBar)); 833 EXPECT_TRUE(prefs->IsManagedPreference(bookmarks::prefs::kShowBookmarkBar));
834 EXPECT_FALSE(prefs->GetBoolean(prefs::kShowBookmarkBar)); 834 EXPECT_FALSE(prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar));
835 // The bookmark bar is hidden in the NTP when disabled by policy. 835 // The bookmark bar is hidden in the NTP when disabled by policy.
836 EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); 836 EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state());
837 837
838 policies.Clear(); 838 policies.Clear();
839 UpdateProviderPolicy(policies); 839 UpdateProviderPolicy(policies);
840 EXPECT_FALSE(prefs->IsManagedPreference(prefs::kShowBookmarkBar)); 840 EXPECT_FALSE(prefs->IsManagedPreference(bookmarks::prefs::kShowBookmarkBar));
841 EXPECT_FALSE(prefs->GetBoolean(prefs::kShowBookmarkBar)); 841 EXPECT_FALSE(prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar));
842 // The bookmark bar is shown detached in the NTP, when disabled by prefs only. 842 // The bookmark bar is shown detached in the NTP, when disabled by prefs only.
843 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); 843 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state());
844 } 844 }
845 845
846 IN_PROC_BROWSER_TEST_F(PolicyTest, PRE_PRE_DefaultCookiesSetting) { 846 IN_PROC_BROWSER_TEST_F(PolicyTest, PRE_PRE_DefaultCookiesSetting) {
847 // Verifies that cookies are deleted on shutdown. This test is split in 3 847 // Verifies that cookies are deleted on shutdown. This test is split in 3
848 // parts because it spans 2 browser restarts. 848 // parts because it spans 2 browser restarts.
849 849
850 Profile* profile = browser()->profile(); 850 Profile* profile = browser()->profile();
851 GURL url(kURL); 851 GURL url(kURL);
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after
3210 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 3210 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
3211 browser2->tab_strip_model()->GetActiveWebContents(), 3211 browser2->tab_strip_model()->GetActiveWebContents(),
3212 "domAutomationController.send(window.showModalDialog !== undefined);", 3212 "domAutomationController.send(window.showModalDialog !== undefined);",
3213 &result)); 3213 &result));
3214 EXPECT_TRUE(result); 3214 EXPECT_TRUE(result);
3215 } 3215 }
3216 3216
3217 #endif // !defined(CHROME_OS) 3217 #endif // !defined(CHROME_OS)
3218 3218
3219 } // namespace policy 3219 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698