OLD | NEW |
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 <memory> | 5 #include <memory> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 // Sets up a mock policy provider for user and device policies. | 1308 // Sets up a mock policy provider for user and device policies. |
1309 EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_)) | 1309 EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_)) |
1310 .WillRepeatedly(testing::Return(true)); | 1310 .WillRepeatedly(testing::Return(true)); |
1311 | 1311 |
1312 policy::PolicyMap policy_map; | 1312 policy::PolicyMap policy_map; |
1313 #if defined(OS_CHROMEOS) | 1313 #if defined(OS_CHROMEOS) |
1314 if (enroll_) | 1314 if (enroll_) |
1315 SetEnterpriseUsersDefaults(&policy_map); | 1315 SetEnterpriseUsersDefaults(&policy_map); |
1316 #endif | 1316 #endif |
1317 if (set_allow_dinosaur_easter_egg_) { | 1317 if (set_allow_dinosaur_easter_egg_) { |
1318 policy_map.Set(policy::key::kAllowDinosaurEasterEgg, | 1318 policy_map.Set( |
1319 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, | 1319 policy::key::kAllowDinosaurEasterEgg, policy::POLICY_LEVEL_MANDATORY, |
1320 policy::POLICY_SOURCE_CLOUD, | 1320 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, |
1321 base::MakeUnique<base::FundamentalValue>( | 1321 base::MakeUnique<base::Value>(value_of_allow_dinosaur_easter_egg_), |
1322 value_of_allow_dinosaur_easter_egg_), | 1322 nullptr); |
1323 nullptr); | |
1324 } | 1323 } |
1325 policy_provider_.UpdateChromePolicy(policy_map); | 1324 policy_provider_.UpdateChromePolicy(policy_map); |
1326 | 1325 |
1327 #if defined(OS_CHROMEOS) | 1326 #if defined(OS_CHROMEOS) |
1328 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( | 1327 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( |
1329 &policy_provider_); | 1328 &policy_provider_); |
1330 #else | 1329 #else |
1331 policy::ProfilePolicyConnectorFactory::GetInstance() | 1330 policy::ProfilePolicyConnectorFactory::GetInstance() |
1332 ->PushProviderForTesting(&policy_provider_); | 1331 ->PushProviderForTesting(&policy_provider_); |
1333 #endif | 1332 #endif |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 class ErrorPageWithHttp09OnNonDefaultPortsTest : public InProcessBrowserTest { | 1505 class ErrorPageWithHttp09OnNonDefaultPortsTest : public InProcessBrowserTest { |
1507 public: | 1506 public: |
1508 // InProcessBrowserTest: | 1507 // InProcessBrowserTest: |
1509 void SetUp() override { | 1508 void SetUp() override { |
1510 EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_)) | 1509 EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_)) |
1511 .WillRepeatedly(testing::Return(true)); | 1510 .WillRepeatedly(testing::Return(true)); |
1512 policy::PolicyMap values; | 1511 policy::PolicyMap values; |
1513 values.Set(policy::key::kHttp09OnNonDefaultPortsEnabled, | 1512 values.Set(policy::key::kHttp09OnNonDefaultPortsEnabled, |
1514 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, | 1513 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, |
1515 policy::POLICY_SOURCE_CLOUD, | 1514 policy::POLICY_SOURCE_CLOUD, |
1516 base::WrapUnique(new base::FundamentalValue(true)), nullptr); | 1515 base::WrapUnique(new base::Value(true)), nullptr); |
1517 policy_provider_.UpdateChromePolicy(values); | 1516 policy_provider_.UpdateChromePolicy(values); |
1518 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( | 1517 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( |
1519 &policy_provider_); | 1518 &policy_provider_); |
1520 | 1519 |
1521 InProcessBrowserTest::SetUp(); | 1520 InProcessBrowserTest::SetUp(); |
1522 } | 1521 } |
1523 | 1522 |
1524 private: | 1523 private: |
1525 policy::MockConfigurationPolicyProvider policy_provider_; | 1524 policy::MockConfigurationPolicyProvider policy_provider_; |
1526 }; | 1525 }; |
1527 | 1526 |
1528 // Make sure HTTP/0.9 works on non-default ports when enabled by policy. | 1527 // Make sure HTTP/0.9 works on non-default ports when enabled by policy. |
1529 IN_PROC_BROWSER_TEST_F(ErrorPageWithHttp09OnNonDefaultPortsTest, | 1528 IN_PROC_BROWSER_TEST_F(ErrorPageWithHttp09OnNonDefaultPortsTest, |
1530 Http09WeirdPortEnabled) { | 1529 Http09WeirdPortEnabled) { |
1531 const char kHttp09Response[] = "JumboShrimp"; | 1530 const char kHttp09Response[] = "JumboShrimp"; |
1532 ASSERT_TRUE(embedded_test_server()->Start()); | 1531 ASSERT_TRUE(embedded_test_server()->Start()); |
1533 ui_test_utils::NavigateToURL( | 1532 ui_test_utils::NavigateToURL( |
1534 browser(), embedded_test_server()->GetURL(std::string("/echo-raw?") + | 1533 browser(), embedded_test_server()->GetURL(std::string("/echo-raw?") + |
1535 kHttp09Response)); | 1534 kHttp09Response)); |
1536 EXPECT_TRUE(IsDisplayingText(browser(), kHttp09Response)); | 1535 EXPECT_TRUE(IsDisplayingText(browser(), kHttp09Response)); |
1537 } | 1536 } |
1538 | 1537 |
1539 } // namespace | 1538 } // namespace |
OLD | NEW |