| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "OriginTrialsTest.h" | 5 #include "OriginTrialsTest.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
| 9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
| 10 #include "core/origin_trials/OriginTrials.h" | 10 #include "core/origin_trials/OriginTrials.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 bool OriginTrialsTest::normalAttribute() { | |
| 15 return true; | |
| 16 } | |
| 17 | |
| 18 // static | |
| 19 bool OriginTrialsTest::staticAttribute() { | |
| 20 return true; | |
| 21 } | |
| 22 | |
| 23 bool OriginTrialsTest::throwingAttribute(ScriptState* script_state, | 14 bool OriginTrialsTest::throwingAttribute(ScriptState* script_state, |
| 24 ExceptionState& exception_state) { | 15 ExceptionState& exception_state) { |
| 25 String error_message; | 16 String error_message; |
| 26 if (!OriginTrials::originTrialsSampleAPIEnabled( | 17 if (!OriginTrials::originTrialsSampleAPIEnabled( |
| 27 ExecutionContext::From(script_state))) { | 18 ExecutionContext::From(script_state))) { |
| 28 exception_state.ThrowDOMException( | 19 exception_state.ThrowDOMException( |
| 29 kNotSupportedError, | 20 kNotSupportedError, |
| 30 "The Origin Trials Sample API has not been enabled in this context"); | 21 "The Origin Trials Sample API has not been enabled in this context"); |
| 31 return false; | 22 return false; |
| 32 } | 23 } |
| 33 return unconditionalAttribute(); | 24 return unconditionalAttribute(); |
| 34 } | 25 } |
| 35 | 26 |
| 36 bool OriginTrialsTest::unconditionalAttribute() { | |
| 37 return true; | |
| 38 } | |
| 39 | |
| 40 DEFINE_TRACE(OriginTrialsTest) {} | 27 DEFINE_TRACE(OriginTrialsTest) {} |
| 41 | 28 |
| 42 } // namespace blink | 29 } // namespace blink |
| OLD | NEW |