| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/cachestorage/Cache.h" | 6 #include "modules/cachestorage/Cache.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
| 10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 ExceptionState& exceptionState() | 202 ExceptionState& exceptionState() |
| 203 { | 203 { |
| 204 return m_exceptionState; | 204 return m_exceptionState; |
| 205 } | 205 } |
| 206 | 206 |
| 207 private: | 207 private: |
| 208 // A ScriptFunction that creates a test failure if it is ever called. | 208 // A ScriptFunction that creates a test failure if it is ever called. |
| 209 class UnreachableFunction : public ScriptFunction { | 209 class UnreachableFunction : public ScriptFunction { |
| 210 public: | 210 public: |
| 211 static v8::Handle<v8::Function> create(ScriptState* scriptState) | 211 static v8::Local<v8::Function> create(ScriptState* scriptState) |
| 212 { | 212 { |
| 213 UnreachableFunction* self = new UnreachableFunction(scriptState); | 213 UnreachableFunction* self = new UnreachableFunction(scriptState); |
| 214 return self->bindToV8Function(); | 214 return self->bindToV8Function(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 virtual ScriptValue call(ScriptValue value) override | 217 virtual ScriptValue call(ScriptValue value) override |
| 218 { | 218 { |
| 219 ADD_FAILURE() << "Unexpected call to a null ScriptFunction."; | 219 ADD_FAILURE() << "Unexpected call to a null ScriptFunction."; |
| 220 return value; | 220 return value; |
| 221 } | 221 } |
| 222 private: | 222 private: |
| 223 UnreachableFunction(ScriptState* scriptState) : ScriptFunction(scriptSta
te) { } | 223 UnreachableFunction(ScriptState* scriptState) : ScriptFunction(scriptSta
te) { } |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 // A ScriptFunction that saves its parameter; used by tests to assert on cor
rect | 226 // A ScriptFunction that saves its parameter; used by tests to assert on cor
rect |
| 227 // values being passed. | 227 // values being passed. |
| 228 class TestFunction : public ScriptFunction { | 228 class TestFunction : public ScriptFunction { |
| 229 public: | 229 public: |
| 230 static v8::Handle<v8::Function> create(ScriptState* scriptState, ScriptV
alue* outValue) | 230 static v8::Local<v8::Function> create(ScriptState* scriptState, ScriptVa
lue* outValue) |
| 231 { | 231 { |
| 232 TestFunction* self = new TestFunction(scriptState, outValue); | 232 TestFunction* self = new TestFunction(scriptState, outValue); |
| 233 return self->bindToV8Function(); | 233 return self->bindToV8Function(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 virtual ScriptValue call(ScriptValue value) override | 236 virtual ScriptValue call(ScriptValue value) override |
| 237 { | 237 { |
| 238 ASSERT(!value.isEmpty()); | 238 ASSERT(!value.isEmpty()); |
| 239 *m_value = value; | 239 *m_value = value; |
| 240 return value; | 240 return value; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 } | 551 } |
| 552 | 552 |
| 553 result = cache->deleteFunction(scriptState(), stringToRequestInfo("http://so
me.url/"), options, exceptionState()); | 553 result = cache->deleteFunction(scriptState(), stringToRequestInfo("http://so
me.url/"), options, exceptionState()); |
| 554 scriptValue = getResolveValue(result); | 554 scriptValue = getResolveValue(result); |
| 555 EXPECT_TRUE(scriptValue.v8Value()->IsBoolean()); | 555 EXPECT_TRUE(scriptValue.v8Value()->IsBoolean()); |
| 556 EXPECT_EQ(true, scriptValue.v8Value()->BooleanValue()); | 556 EXPECT_EQ(true, scriptValue.v8Value()->BooleanValue()); |
| 557 } | 557 } |
| 558 | 558 |
| 559 } // namespace | 559 } // namespace |
| 560 } // namespace blink | 560 } // namespace blink |
| OLD | NEW |