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