| 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/memory/ref_counted.h" |
| 6 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 7 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
| 8 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 9 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" | 10 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" |
| 10 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 11 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 11 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 12 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 12 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 13 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 13 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" | 14 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" |
| 14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 const std::string& signed_data, | 67 const std::string& signed_data, |
| 67 const std::string& signature, | 68 const std::string& signature, |
| 68 const std::string& platform_key_certificate) { | 69 const std::string& platform_key_certificate) { |
| 69 result_ = result; | 70 result_ = result; |
| 70 operation_complete_ = true; | 71 operation_complete_ = true; |
| 71 } | 72 } |
| 72 | 73 |
| 73 // Synchronously do what the content protection code path does when it wants | 74 // Synchronously do what the content protection code path does when it wants |
| 74 // to verify a Chrome OS platform. | 75 // to verify a Chrome OS platform. |
| 75 PlatformVerificationFlow::Result SyncContentProtectionAttestation() { | 76 PlatformVerificationFlow::Result SyncContentProtectionAttestation() { |
| 76 PlatformVerificationFlow verifier(NULL, NULL, &fake_cryptohome_client_, | 77 scoped_refptr<PlatformVerificationFlow> verifier( |
| 77 NULL, NULL); | 78 new PlatformVerificationFlow(NULL, NULL, &fake_cryptohome_client_, NULL, |
| 78 verifier.ChallengePlatformKey( | 79 NULL)); |
| 80 verifier->ChallengePlatformKey( |
| 79 browser()->tab_strip_model()->GetActiveWebContents(), | 81 browser()->tab_strip_model()->GetActiveWebContents(), |
| 80 "fake_service_id", | 82 "fake_service_id", |
| 81 "fake_challenge", | 83 "fake_challenge", |
| 82 base::Bind(&AttestationDevicePolicyTest::Callback, this)); | 84 base::Bind(&AttestationDevicePolicyTest::Callback, this)); |
| 83 WaitForAsyncOperation(); | 85 WaitForAsyncOperation(); |
| 84 return result_; | 86 return result_; |
| 85 } | 87 } |
| 86 | 88 |
| 87 private: | 89 private: |
| 88 bool operation_complete_; | 90 bool operation_complete_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 113 SyncContentProtectionAttestation()); | 115 SyncContentProtectionAttestation()); |
| 114 | 116 |
| 115 GetDevicePolicyProto()->set_content_protection_enabled(true); | 117 GetDevicePolicyProto()->set_content_protection_enabled(true); |
| 116 SyncRefreshDevicePolicy(); | 118 SyncRefreshDevicePolicy(); |
| 117 | 119 |
| 118 EXPECT_NE(PlatformVerificationFlow::POLICY_REJECTED, | 120 EXPECT_NE(PlatformVerificationFlow::POLICY_REJECTED, |
| 119 SyncContentProtectionAttestation()); | 121 SyncContentProtectionAttestation()); |
| 120 } | 122 } |
| 121 | 123 |
| 122 } // namespace policy | 124 } // namespace policy |
| OLD | NEW |