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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 ++m_fetchCount; | 47 ++m_fetchCount; |
48 if (m_expectedUrl) { | 48 if (m_expectedUrl) { |
49 String fetchedUrl; | 49 String fetchedUrl; |
50 if (requestInfo.isRequest()) | 50 if (requestInfo.isRequest()) |
51 EXPECT_EQ(*m_expectedUrl, requestInfo.getAsRequest()->url()); | 51 EXPECT_EQ(*m_expectedUrl, requestInfo.getAsRequest()->url()); |
52 else | 52 else |
53 EXPECT_EQ(*m_expectedUrl, requestInfo.getAsUSVString()); | 53 EXPECT_EQ(*m_expectedUrl, requestInfo.getAsUSVString()); |
54 } | 54 } |
55 | 55 |
56 if (m_response) { | 56 if (m_response) { |
57 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseRe
solver::create(scriptState); | 57 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scri
ptState); |
58 const ScriptPromise promise = resolver->promise(); | 58 const ScriptPromise promise = resolver->promise(); |
59 resolver->resolve(m_response); | 59 resolver->resolve(m_response); |
60 m_response = nullptr; | 60 m_response = nullptr; |
61 return promise; | 61 return promise; |
62 } | 62 } |
63 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Unexpected call to fetch, no response available."))
; | 63 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Unexpected call to fetch, no response available."))
; |
64 } | 64 } |
65 | 65 |
66 WeakPtr<GlobalFetch::ScopedFetcher> weakPtr() | 66 WeakPtr<GlobalFetch::ScopedFetcher> weakPtr() |
67 { | 67 { |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 643 |
644 ScriptPromise addResult = cache->add(scriptState(), requestToRequestInfo(req
uest), exceptionState()); | 644 ScriptPromise addResult = cache->add(scriptState(), requestToRequestInfo(req
uest), exceptionState()); |
645 | 645 |
646 EXPECT_EQ(kNotImplementedString, getRejectString(addResult)); | 646 EXPECT_EQ(kNotImplementedString, getRejectString(addResult)); |
647 EXPECT_EQ(1, fetcher()->fetchCount()); | 647 EXPECT_EQ(1, fetcher()->fetchCount()); |
648 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); | 648 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); |
649 } | 649 } |
650 | 650 |
651 } // namespace | 651 } // namespace |
652 } // namespace blink | 652 } // namespace blink |
OLD | NEW |