OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/policy/device_local_account.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 const PolicyNamespace ns(POLICY_DOMAIN_EXTENSIONS, kShowManagedStorageID); | 2285 const PolicyNamespace ns(POLICY_DOMAIN_EXTENSIONS, kShowManagedStorageID); |
2286 if (policy_service->GetPolicies(ns).empty()) { | 2286 if (policy_service->GetPolicies(ns).empty()) { |
2287 PolicyChangeRegistrar policy_registrar(policy_service, ns); | 2287 PolicyChangeRegistrar policy_registrar(policy_service, ns); |
2288 base::RunLoop run_loop; | 2288 base::RunLoop run_loop; |
2289 policy_registrar.Observe( | 2289 policy_registrar.Observe( |
2290 "string", base::Bind(&PolicyChangedCallback, run_loop.QuitClosure())); | 2290 "string", base::Bind(&PolicyChangedCallback, run_loop.QuitClosure())); |
2291 run_loop.Run(); | 2291 run_loop.Run(); |
2292 } | 2292 } |
2293 | 2293 |
2294 // Verify that the app policy was set. | 2294 // Verify that the app policy was set. |
2295 base::StringValue expected_value("policy test value one"); | 2295 base::Value expected_value("policy test value one"); |
2296 EXPECT_TRUE(base::Value::Equals( | 2296 EXPECT_TRUE(base::Value::Equals( |
2297 &expected_value, | 2297 &expected_value, |
2298 policy_service->GetPolicies(ns).GetValue("string"))); | 2298 policy_service->GetPolicies(ns).GetValue("string"))); |
2299 | 2299 |
2300 // Now update the policy at the server. | 2300 // Now update the policy at the server. |
2301 ASSERT_TRUE(test_server_.UpdatePolicyData( | 2301 ASSERT_TRUE(test_server_.UpdatePolicyData( |
2302 dm_protocol::kChromeExtensionPolicyType, kShowManagedStorageID, | 2302 dm_protocol::kChromeExtensionPolicyType, kShowManagedStorageID, |
2303 "{" | 2303 "{" |
2304 " \"string\": {" | 2304 " \"string\": {" |
2305 " \"Value\": \"policy test value two\"" | 2305 " \"Value\": \"policy test value two\"" |
2306 " }" | 2306 " }" |
2307 "}")); | 2307 "}")); |
2308 | 2308 |
2309 // And issue a policy refresh. | 2309 // And issue a policy refresh. |
2310 { | 2310 { |
2311 PolicyChangeRegistrar policy_registrar(policy_service, ns); | 2311 PolicyChangeRegistrar policy_registrar(policy_service, ns); |
2312 base::RunLoop run_loop; | 2312 base::RunLoop run_loop; |
2313 policy_registrar.Observe( | 2313 policy_registrar.Observe( |
2314 "string", base::Bind(&PolicyChangedCallback, run_loop.QuitClosure())); | 2314 "string", base::Bind(&PolicyChangedCallback, run_loop.QuitClosure())); |
2315 policy_service->RefreshPolicies(base::Closure()); | 2315 policy_service->RefreshPolicies(base::Closure()); |
2316 run_loop.Run(); | 2316 run_loop.Run(); |
2317 } | 2317 } |
2318 | 2318 |
2319 // Verify that the app policy was updated. | 2319 // Verify that the app policy was updated. |
2320 base::StringValue expected_new_value("policy test value two"); | 2320 base::Value expected_new_value("policy test value two"); |
2321 EXPECT_TRUE(base::Value::Equals( | 2321 EXPECT_TRUE(base::Value::Equals( |
2322 &expected_new_value, | 2322 &expected_new_value, |
2323 policy_service->GetPolicies(ns).GetValue("string"))); | 2323 policy_service->GetPolicies(ns).GetValue("string"))); |
2324 } | 2324 } |
2325 | 2325 |
2326 class TermsOfServiceDownloadTest : public DeviceLocalAccountTest, | 2326 class TermsOfServiceDownloadTest : public DeviceLocalAccountTest, |
2327 public testing::WithParamInterface<bool> { | 2327 public testing::WithParamInterface<bool> { |
2328 }; | 2328 }; |
2329 | 2329 |
2330 IN_PROC_BROWSER_TEST_P(TermsOfServiceDownloadTest, TermsOfServiceScreen) { | 2330 IN_PROC_BROWSER_TEST_P(TermsOfServiceDownloadTest, TermsOfServiceScreen) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 ASSERT_TRUE(content::ExecuteScript(contents_, | 2448 ASSERT_TRUE(content::ExecuteScript(contents_, |
2449 "$('tos-accept-button').click();")); | 2449 "$('tos-accept-button').click();")); |
2450 | 2450 |
2451 WaitForSessionStart(); | 2451 WaitForSessionStart(); |
2452 } | 2452 } |
2453 | 2453 |
2454 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2454 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
2455 TermsOfServiceDownloadTest, testing::Bool()); | 2455 TermsOfServiceDownloadTest, testing::Bool()); |
2456 | 2456 |
2457 } // namespace policy | 2457 } // namespace policy |
OLD | NEW |