| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/location.h" |
| 6 #include "base/macros.h" | 7 #include "base/macros.h" |
| 7 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 9 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 11 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" | 14 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" |
| 12 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 15 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 13 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 16 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 14 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 17 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 15 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 18 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 16 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chromeos/dbus/fake_cryptohome_client.h" | 21 #include "chromeos/dbus/fake_cryptohome_client.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 23 |
| 21 using chromeos::attestation::PlatformVerificationFlow; | 24 using chromeos::attestation::PlatformVerificationFlow; |
| 22 | 25 |
| 23 namespace policy { | 26 namespace policy { |
| 24 | 27 |
| 25 class CustomFakeCryptohomeClient : public chromeos::FakeCryptohomeClient { | 28 class CustomFakeCryptohomeClient : public chromeos::FakeCryptohomeClient { |
| 26 public: | 29 public: |
| 27 void TpmAttestationIsEnrolled( | 30 void TpmAttestationIsEnrolled( |
| 28 const chromeos::BoolDBusMethodCallback& callback) override { | 31 const chromeos::BoolDBusMethodCallback& callback) override { |
| 29 base::MessageLoop::current()->PostTask( | 32 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 30 FROM_HERE, | 33 FROM_HERE, |
| 31 base::Bind(callback, chromeos::DBUS_METHOD_CALL_FAILURE, false)); | 34 base::Bind(callback, chromeos::DBUS_METHOD_CALL_FAILURE, false)); |
| 32 } | 35 } |
| 33 }; | 36 }; |
| 34 | 37 |
| 35 class AttestationDevicePolicyTest | 38 class AttestationDevicePolicyTest |
| 36 : public DevicePolicyCrosBrowserTest, | 39 : public DevicePolicyCrosBrowserTest, |
| 37 public chromeos::DeviceSettingsService::Observer { | 40 public chromeos::DeviceSettingsService::Observer { |
| 38 public: | 41 public: |
| 39 // DeviceSettingsService::Observer | 42 // DeviceSettingsService::Observer |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 SyncContentProtectionAttestation()); | 118 SyncContentProtectionAttestation()); |
| 116 | 119 |
| 117 GetDevicePolicyProto()->set_content_protection_enabled(true); | 120 GetDevicePolicyProto()->set_content_protection_enabled(true); |
| 118 SyncRefreshDevicePolicy(); | 121 SyncRefreshDevicePolicy(); |
| 119 | 122 |
| 120 EXPECT_NE(PlatformVerificationFlow::POLICY_REJECTED, | 123 EXPECT_NE(PlatformVerificationFlow::POLICY_REJECTED, |
| 121 SyncContentProtectionAttestation()); | 124 SyncContentProtectionAttestation()); |
| 122 } | 125 } |
| 123 | 126 |
| 124 } // namespace policy | 127 } // namespace policy |
| OLD | NEW |