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

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

Issue 10985073: Fixed flakiness of the PolicyTest.Javascript browser_test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 EXPECT_TRUE(IsJavascriptEnabled(contents)); 1036 EXPECT_TRUE(IsJavascriptEnabled(contents));
1037 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEV_TOOLS)); 1037 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEV_TOOLS));
1038 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEV_TOOLS_CONSOLE)); 1038 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEV_TOOLS_CONSOLE));
1039 1039
1040 // Disable Javascript via policy. 1040 // Disable Javascript via policy.
1041 PolicyMap policies; 1041 PolicyMap policies;
1042 policies.Set(key::kJavascriptEnabled, POLICY_LEVEL_MANDATORY, 1042 policies.Set(key::kJavascriptEnabled, POLICY_LEVEL_MANDATORY,
1043 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false)); 1043 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false));
1044 provider_.UpdateChromePolicy(policies); 1044 provider_.UpdateChromePolicy(policies);
1045 // Reload the page. 1045 // Reload the page.
1046 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); 1046 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL));
1047 EXPECT_FALSE(IsJavascriptEnabled(contents)); 1047 EXPECT_FALSE(IsJavascriptEnabled(contents));
1048 // Developer tools still work when javascript is disabled. 1048 // Developer tools still work when javascript is disabled.
1049 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEV_TOOLS)); 1049 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEV_TOOLS));
1050 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEV_TOOLS_CONSOLE)); 1050 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEV_TOOLS_CONSOLE));
1051 // Javascript is always enabled for the internal pages. 1051 // Javascript is always enabled for the internal pages.
1052 ui_test_utils::NavigateToURL(browser(), GURL("chrome://settings")); 1052 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIAboutURL));
1053 EXPECT_TRUE(IsJavascriptEnabled(contents)); 1053 EXPECT_TRUE(IsJavascriptEnabled(contents));
1054 1054
1055 // The javascript content setting policy overrides the javascript policy. 1055 // The javascript content setting policy overrides the javascript policy.
1056 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); 1056 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL));
1057 EXPECT_FALSE(IsJavascriptEnabled(contents)); 1057 EXPECT_FALSE(IsJavascriptEnabled(contents));
1058 policies.Set(key::kDefaultJavaScriptSetting, POLICY_LEVEL_MANDATORY, 1058 policies.Set(key::kDefaultJavaScriptSetting, POLICY_LEVEL_MANDATORY,
1059 POLICY_SCOPE_USER, 1059 POLICY_SCOPE_USER,
1060 base::Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); 1060 base::Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
1061 provider_.UpdateChromePolicy(policies); 1061 provider_.UpdateChromePolicy(policies);
1062 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); 1062 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL));
1063 EXPECT_TRUE(IsJavascriptEnabled(contents)); 1063 EXPECT_TRUE(IsJavascriptEnabled(contents));
1064 } 1064 }
1065 1065
1066 IN_PROC_BROWSER_TEST_F(PolicyTest, SavingBrowserHistoryDisabled) { 1066 IN_PROC_BROWSER_TEST_F(PolicyTest, SavingBrowserHistoryDisabled) {
1067 // Verifies that browsing history is not saved. 1067 // Verifies that browsing history is not saved.
1068 PolicyMap policies; 1068 PolicyMap policies;
1069 policies.Set(key::kSavingBrowserHistoryDisabled, POLICY_LEVEL_MANDATORY, 1069 policies.Set(key::kSavingBrowserHistoryDisabled, POLICY_LEVEL_MANDATORY,
1070 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true)); 1070 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true));
1071 provider_.UpdateChromePolicy(policies); 1071 provider_.UpdateChromePolicy(policies);
1072 GURL url = ui_test_utils::GetTestUrl( 1072 GURL url = ui_test_utils::GetTestUrl(
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 INSTANTIATE_TEST_CASE_P( 1401 INSTANTIATE_TEST_CASE_P(
1402 RestoreOnStartupPolicyTestInstance, 1402 RestoreOnStartupPolicyTestInstance,
1403 RestoreOnStartupPolicyTest, 1403 RestoreOnStartupPolicyTest,
1404 testing::Values(&RestoreOnStartupPolicyTest::HomepageIsNotNTP, 1404 testing::Values(&RestoreOnStartupPolicyTest::HomepageIsNotNTP,
1405 &RestoreOnStartupPolicyTest::HomepageIsNTP, 1405 &RestoreOnStartupPolicyTest::HomepageIsNTP,
1406 &RestoreOnStartupPolicyTest::ListOfURLs, 1406 &RestoreOnStartupPolicyTest::ListOfURLs,
1407 &RestoreOnStartupPolicyTest::NTP, 1407 &RestoreOnStartupPolicyTest::NTP,
1408 &RestoreOnStartupPolicyTest::Last)); 1408 &RestoreOnStartupPolicyTest::Last));
1409 1409
1410 } // namespace policy 1410 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698