| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/testing/NullExecutionContext.h" | 5 #include "core/testing/NullExecutionContext.h" |
| 6 | 6 |
| 7 #include "core/dom/ExecutionContextTask.h" | 7 #include "core/dom/ExecutionContextTask.h" |
| 8 #include "core/events/Event.h" | 8 #include "core/events/Event.h" |
| 9 #include "core/frame/DOMTimer.h" | 9 #include "core/frame/DOMTimer.h" |
| 10 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 class NullEventQueue final : public EventQueue { | 16 class NullEventQueue final : public EventQueue { |
| 16 public: | 17 public: |
| 17 NullEventQueue() {} | 18 NullEventQueue() {} |
| 18 ~NullEventQueue() override {} | 19 ~NullEventQueue() override {} |
| 19 bool EnqueueEvent(Event*) override { return true; } | 20 bool EnqueueEvent(Event*) override { return true; } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 38 } | 39 } |
| 39 | 40 |
| 40 bool NullExecutionContext::IsSecureContext( | 41 bool NullExecutionContext::IsSecureContext( |
| 41 String& error_message, | 42 String& error_message, |
| 42 const SecureContextCheck privilege_context_check) const { | 43 const SecureContextCheck privilege_context_check) const { |
| 43 if (!is_secure_context_) | 44 if (!is_secure_context_) |
| 44 error_message = "A secure context is required"; | 45 error_message = "A secure context is required"; |
| 45 return is_secure_context_; | 46 return is_secure_context_; |
| 46 } | 47 } |
| 47 | 48 |
| 49 void NullExecutionContext::SetUpSecurityContext() { |
| 50 ContentSecurityPolicy* policy = ContentSecurityPolicy::Create(); |
| 51 SecurityContext::SetSecurityOrigin(SecurityOrigin::Create(dummy_url_)); |
| 52 policy->BindToExecutionContext(this); |
| 53 SecurityContext::SetContentSecurityPolicy(policy); |
| 54 } |
| 55 |
| 48 } // namespace blink | 56 } // namespace blink |
| OLD | NEW |